I am trying to add a new member by calling the membership constructor and adding it to the arraylist. However

I am trying to add a new member by calling the membership constructor and adding it to the arraylist. However, it doesn’t add to the list. The initial members in public memberships() are added, but the one being created is not being added in public void addMemberships(). I have noticed if I had a new member in the public Memberships() or public void printMemberships it adds a new member but not in the public void addMembership(). I have also tried creating a Membership object first and then adding it to the arraylist but still, it doesn’t add.

import java.util.ArrayList;

public class Memberships {

private ArrayList Memberships = new ArrayList();
public Memberships(){
Memberships.add(new Membership(“Thomas Muller”, “.email”, “99991111”, “3 Byern St. Sydney 2001”, “13697480”, 2134.5));
Memberships.add(new Membership(“Alice Stefan”, “email”, “88881111”, “24 Pitt St. Sydney”, “14517880”, 4512.2));
Memberships.add(new Membership(“Lucy Lu”, “email”, “98981100”, “11 Hunter St. Sydney 2100”, “13267102”, 158.4));
Memberships.add(new Membership(“Andreas Brehme”, “email”, “90001222”, “91 Sussex St. Sydney 2100”, “13678020”, 7596.3));
Memberships.add(new Membership(“Ruddy Voller”, “email”, “98980000”, “15 Stan St. Sydney 2100”, “13972870”, 1100.0));
Memberships.add(new Membership(“Monica Shwarz”, “email”, “92241188”, “155 Jones St. Sydney 2001”, “13859610”, 6741.2));

public void addMembership(){
String mName = Utils.string(“Name”);
String mEmail = Utils.string(“Email”);
String mPhone = Utils.string(“Phone”);
String mAddress = Utils.string(“Address”);
String mID = Utils.string(“ID”);
double mExpense = Utils.amount(“expense”);
Memberships.add(new Membership(mName, mEmail, mPhone, mAddress, mID, mExpense));
System.out.println(mName + ” record has been created.”);

public void printMemberships(){
String memName;
String memEmail;
String memPhone;
String memType;
for(Membership Membership : Memberships){
memName = Membership.getName();
memEmail = Membership.getEmail();
memPhone = Membership.getPhone();
memType = Membership.getType();

public class Membership {
private String ID;
private String name;
private String email;
private String phone;
private String address;
private String type;
private double expense;
private int payPerCredit;
private double totalCredits;
private double GasdeductionRate;
private int DollarAvailable;

private double deductionRate;
private SuperMarket SuperMarket;

public Membership(String name, String email, String phone, String address, String ID, double expense){
this.name = name;
this.email = email;
this.phone = phone;
this.address = address;
this.ID = ID;
this.expense = expense;
if(expense<500){ type = "Bronze"; } else if(expense>=500 && expense<1500){ type = "Silver"; } else if(expense>=1500 && expense<3000){ type = "Gold"; } else if(expense>=3000 && expense<5000){ type = "Diamond"; } else if(expense>=5000){
type = “Platinum”;

public String getName(){
return this.name;
public String getEmail(){
return this.email;
public String getPhone(){
return this.phone;
public String getType(){
return type;

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?