Question: this is the code i already have : for 4 classes ----------------------------- ----------------------------- ----------------------------------- ----------------------------- and this is what i have to add to it:













package client; public class Goldenclient private int gldNo; private String id; private string name; private double balance; public Goldenclient (string id, String name, double balance){ this.id = id; this.name = name; if (balance > 0) { this.balance = balance; } else { this.balance - balance; } 3 public int getGldNOK return gldo; } public void setGldNo (int gldNo) { this.gdno - gldNo; } public String getId(){ return id; ) public void set Id (string id){ this.id = id; } public String getName(){ return name; public void setName(String name) { this.name = name; public double getBalance (){ return balance; public void setBalance ( double balance) this.balance = balance; ) public void deposit (double amount){ if (amount > 0) { } public void deposit (double amount) { if ( amount > 0) { this.balance + amount ; System.out.println("Your balance is: "+ balance); 1 else { System.out.println("Amount can not be negativel"); } public void depit (double amount > if ( amount > this.balance || amount 0) { this.balance . balance; ) else { this.balance - 0.0; public int getNorNo() { return norNo; } public void setNorno (int norno) this.norNo - norNo; 1 public string getido return id; ) public void setId(String id) { this.id = id; 1 public string getName Of return name; ) public void setName (String name) { this.name = name; ) public double getbalance () { return balance; } public void deposit (double amount) { if (amount > 0) { this.balance + amount ; System.out.println("Your balance is: +balance ); System.out.println("Your balance is: balance ); else System.out.println("Amount can not be negativel"); ) ) public void debit (double amount if ( amount > this.balance 11 anount 0){ this.balance = initialBalance; ) else { this.balance = 0.8; Client (Client c){ this.ID C.getID(); this. Name - C.getName(); this.balance. c.getbalance(); > @Override public string tostring of return "el tent":"10" 10 ", Name + Name + ", balance". balance. y; public void deposit (double deposit){ this.balance - deposit; System.out.println(this.balance); public void depit (double withdraw) Scanner scan. new Scanner (systen, in); boolean contiue - true; while (contiue) if (withdraw printclients normalclients); printclients(goldenclients); int choice.0; do System.out.println("1. Deposit " "2. Debit " "3. Show Balance " + "4. Exit"); System.out.print("Enter choice: "); choice. Integer.parseInt(scan.nextLine()); switch (choice) ( case 1: System.out.print("Enter client type (Normal/Golden): "); String type = scan.nextLine(); System.out.print("Enter name: "); String name = scan.nextLine(); System.out.print("Enter amount: "); double amount Double.parseDouble(scan.nextLine()); if (type.equalsignorecase("normal")) { int flag - e; for (Normalclient normalclient : normalclients) { if (normalclient.getName().equalsignorecase(name)) { normalClient.deposit(amount); flag - 1; ) } if (flag System.out.println("Client not found!"); } } else { } int flag-; for (Goldenclient goldenclient : goldenclients) { if (goldenclient.getName().equalsignorecase(name)) { goldenclient.deposit(amount); flag - 1; ) } if (flag a) { System.out.println("Client not found!"); } } break; case 2: System.out.print("Enter client type (Normal/Golden): "); type = scan.nextLine(); system.out.print("Enter name: "); name = scan.nextLine(); System.out.print("Enter amount: "); amount - Double.parsedouble(scan.nextLine()); if (type.equalsignorecase("normal")) { int flage; for (Normalclient normalclient: normalclients) { if (normalClient.getName().equalsignorecase (name)) { normalClient.debit(amount); flag - 1; ) if (flag System.out.println("client not found!"); } } else { int flag - e; for (Goldenclient goldenclient : goldenclients) { if (goldenclient.getName().equalsignorecase(name)) { goldenclient.depit(amount); flag - 1; 1 if (flag e) { System.out.println("client not found!"); break; case 3: System.out.print("Enter client type (Normal/Golden): "); type - scan.nextLine(); System.out.print("Enter name: "); nane - scan.nextLine(); if (type.equals Ignorecase("normal)) { int flag - ; for (Normalcitent normalclient: normalClients) { if (normalClient.getName().equalsignorecase(name)) System.out.println("Balance is: * + normalClient.getbalance()); flag - 1; > if (tag) System.out.println("client not found!"); } else int flag -o; for (Goldenci tent goldencident : goldenclients) { if (goldenclient.getName().equalsignorecase(name)) system.out.println("walance is: * + golden lient.petealance()); flag - 1; 1 (flag - 0) System.out.println("client not found!): 1 break; case 4: system.out.println("Thank you!"); break; default: System.out.println("Invalid choice! Try again..."); break; ) while (choice != 4); scan.close(); 3 private static void printclients(Goldenclient[] goldenclients) { for (Goldenclient goldenclient : goldenclients) { System.out.println(goldenclient.toString()); } } private static void printclients (NormalClient[] normalClients) { for (Normalclient normalclient : normalclients) { system.out.println(normalclient.tostring(); ) } } Interface: 1. Create an interface called Account, which contains the following methods: deposit() . debit() transFeeAction() Abstract: Create an abstract class named TypeAccount Make the class inherit/implement this interface Add the following attributes: TypeOfAccount as String. This filed can be assigned one of the options: saving account, income accounts, business account NumberOfAccounts as integer TypeOfCard as String. This filed can be assigned one of the options: Black card, Debit cards, Credit card. Add getLaon(double colorectal) method and make it abstract Take the default methods (deposit-debit- transFeeActions) from the client class and place it here 2. Create an abstract class named Special Privilege Make this class inherit the TypeAccount abstract class Add the following attributes TypeOfClient as String. This field can be assigned with either Normal or Golden Client. Assistance as String. This filed can be assigned with either low or high priority. Include the body of the getLaon() in this class. This method contains the following conditions : If the account is low priority and: an income account, then allow loan of 1000 Riyal a saving account, then do not allow a loan until user provide a colorectal of the same amount If the account is high priority and: an income account, then allow loan of 50000 Riyal a biasness account, then allow a loan of 40% revenue Normal class: Make the client class inherit the Special Privilege interface . Override equal method, Only include comparison of 4 attributes : ID Name TypeOfAccount TypeOfClient Override compareTo method, Only include comparison of 3 attributes : TypeOfClient TypeOfAccount Balance In the main class BankSystem Add another normal client object that has the same name, id , and type account of one of the existing/previously created clients Check if this object is equal to the one you created and print "both objects are equal" if this condition is satisfied Create an array of clients and add all Golden and normal clients currently and previously created, then sort the array . Print the result before and after sorting. package client; public class Goldenclient private int gldNo; private String id; private string name; private double balance; public Goldenclient (string id, String name, double balance){ this.id = id; this.name = name; if (balance > 0) { this.balance = balance; } else { this.balance - balance; } 3 public int getGldNOK return gldo; } public void setGldNo (int gldNo) { this.gdno - gldNo; } public String getId(){ return id; ) public void set Id (string id){ this.id = id; } public String getName(){ return name; public void setName(String name) { this.name = name; public double getBalance (){ return balance; public void setBalance ( double balance) this.balance = balance; ) public void deposit (double amount){ if (amount > 0) { } public void deposit (double amount) { if ( amount > 0) { this.balance + amount ; System.out.println("Your balance is: "+ balance); 1 else { System.out.println("Amount can not be negativel"); } public void depit (double amount > if ( amount > this.balance || amount 0) { this.balance . balance; ) else { this.balance - 0.0; public int getNorNo() { return norNo; } public void setNorno (int norno) this.norNo - norNo; 1 public string getido return id; ) public void setId(String id) { this.id = id; 1 public string getName Of return name; ) public void setName (String name) { this.name = name; ) public double getbalance () { return balance; } public void deposit (double amount) { if (amount > 0) { this.balance + amount ; System.out.println("Your balance is: +balance ); System.out.println("Your balance is: balance ); else System.out.println("Amount can not be negativel"); ) ) public void debit (double amount if ( amount > this.balance 11 anount 0){ this.balance = initialBalance; ) else { this.balance = 0.8; Client (Client c){ this.ID C.getID(); this. Name - C.getName(); this.balance. c.getbalance(); > @Override public string tostring of return "el tent":"10" 10 ", Name + Name + ", balance". balance. y; public void deposit (double deposit){ this.balance - deposit; System.out.println(this.balance); public void depit (double withdraw) Scanner scan. new Scanner (systen, in); boolean contiue - true; while (contiue) if (withdraw printclients normalclients); printclients(goldenclients); int choice.0; do System.out.println("1. Deposit " "2. Debit " "3. Show Balance " + "4. Exit"); System.out.print("Enter choice: "); choice. Integer.parseInt(scan.nextLine()); switch (choice) ( case 1: System.out.print("Enter client type (Normal/Golden): "); String type = scan.nextLine(); System.out.print("Enter name: "); String name = scan.nextLine(); System.out.print("Enter amount: "); double amount Double.parseDouble(scan.nextLine()); if (type.equalsignorecase("normal")) { int flag - e; for (Normalclient normalclient : normalclients) { if (normalclient.getName().equalsignorecase(name)) { normalClient.deposit(amount); flag - 1; ) } if (flag System.out.println("Client not found!"); } } else { } int flag-; for (Goldenclient goldenclient : goldenclients) { if (goldenclient.getName().equalsignorecase(name)) { goldenclient.deposit(amount); flag - 1; ) } if (flag a) { System.out.println("Client not found!"); } } break; case 2: System.out.print("Enter client type (Normal/Golden): "); type = scan.nextLine(); system.out.print("Enter name: "); name = scan.nextLine(); System.out.print("Enter amount: "); amount - Double.parsedouble(scan.nextLine()); if (type.equalsignorecase("normal")) { int flage; for (Normalclient normalclient: normalclients) { if (normalClient.getName().equalsignorecase (name)) { normalClient.debit(amount); flag - 1; ) if (flag System.out.println("client not found!"); } } else { int flag - e; for (Goldenclient goldenclient : goldenclients) { if (goldenclient.getName().equalsignorecase(name)) { goldenclient.depit(amount); flag - 1; 1 if (flag e) { System.out.println("client not found!"); break; case 3: System.out.print("Enter client type (Normal/Golden): "); type - scan.nextLine(); System.out.print("Enter name: "); nane - scan.nextLine(); if (type.equals Ignorecase("normal)) { int flag - ; for (Normalcitent normalclient: normalClients) { if (normalClient.getName().equalsignorecase(name)) System.out.println("Balance is: * + normalClient.getbalance()); flag - 1; > if (tag) System.out.println("client not found!"); } else int flag -o; for (Goldenci tent goldencident : goldenclients) { if (goldenclient.getName().equalsignorecase(name)) system.out.println("walance is: * + golden lient.petealance()); flag - 1; 1 (flag - 0) System.out.println("client not found!): 1 break; case 4: system.out.println("Thank you!"); break; default: System.out.println("Invalid choice! Try again..."); break; ) while (choice != 4); scan.close(); 3 private static void printclients(Goldenclient[] goldenclients) { for (Goldenclient goldenclient : goldenclients) { System.out.println(goldenclient.toString()); } } private static void printclients (NormalClient[] normalClients) { for (Normalclient normalclient : normalclients) { system.out.println(normalclient.tostring(); ) } } Interface: 1. Create an interface called Account, which contains the following methods: deposit() . debit() transFeeAction() Abstract: Create an abstract class named TypeAccount Make the class inherit/implement this interface Add the following attributes: TypeOfAccount as String. This filed can be assigned one of the options: saving account, income accounts, business account NumberOfAccounts as integer TypeOfCard as String. This filed can be assigned one of the options: Black card, Debit cards, Credit card. Add getLaon(double colorectal) method and make it abstract Take the default methods (deposit-debit- transFeeActions) from the client class and place it here 2. Create an abstract class named Special Privilege Make this class inherit the TypeAccount abstract class Add the following attributes TypeOfClient as String. This field can be assigned with either Normal or Golden Client. Assistance as String. This filed can be assigned with either low or high priority. Include the body of the getLaon() in this class. This method contains the following conditions : If the account is low priority and: an income account, then allow loan of 1000 Riyal a saving account, then do not allow a loan until user provide a colorectal of the same amount If the account is high priority and: an income account, then allow loan of 50000 Riyal a biasness account, then allow a loan of 40% revenue Normal class: Make the client class inherit the Special Privilege interface . Override equal method, Only include comparison of 4 attributes : ID Name TypeOfAccount TypeOfClient Override compareTo method, Only include comparison of 3 attributes : TypeOfClient TypeOfAccount Balance In the main class BankSystem Add another normal client object that has the same name, id , and type account of one of the existing/previously created clients Check if this object is equal to the one you created and print "both objects are equal" if this condition is satisfied Create an array of clients and add all Golden and normal clients currently and previously created, then sort the array . Print the result before and after sorting
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
