NEED HELP WITH THIS QUESTION PROGRAMMING LANGUAGE : JAVA A class hierarchy will
ID: 3817590 • Letter: N
Question
NEED HELP WITH THIS QUESTION
PROGRAMMING LANGUAGE : JAVA
A class hierarchy will be created using inheritance to represent clients The "Customer" class should look like this: l-) "CustomerID to represent customer number 2-) "Name" and "Surname" in String type representing first and last name 3-) Unparametric constructor 4-) Constructor that uses all variables 5-) Copy Constructor 6-) toString method 7-) Get and Set methods To represent national customers, derive a class named "National Customcr" with inheritance from the "Customer" class The "National Customer" class should be as follows: l-) "LicenccPlateNumber" in int type to represent the provincial traffic plate code 2-)"Occupation" in String type representing the customer's occupation 3-) Unparametric constructor 4-) Constructor that uses a variables 5-) Copy Constructor 6-) to String method 7-) Get and Set methods To represent international customers, derive a class named "International Customer" with inheritance from the "Customer" class The "International Customer" class should be as follows: 1-"Country" in the String type representing the country 2-)"City" in int type representing the city 3-) Unparametric constructor 4-) Constructor that uses all variables 5-) Copy Constructor 6-0 toString method 7-) Get and Set methods The first linc of thc file contains thc namc of thc product and the product namcs. For examplc, 5 The product is ratcd and the names of these products are given as products A, B, C, D and E The following lines are arranged as follows: customer information first (n: national, i n international meaning), On the bottom line there are grades that the relevant customer has made for the products. A comma-separated-value(CSV) file is a simple text format used to store a list of records. A comma is used a delimiter to separate the fields for each record. This format is commonly used to transfer data between a spreadsheet or database. The first line of the file contains the name of the product and the product names. For example, 5 The product is rated and the names of these products are given as products A, B, C, D and EExplanation / Answer
Bank class:
open class Bank {
String bankName;
private Customer[] clients = new Customer[100];
Bank(String bankName) {
this.bankName = bankName;
}
open Customer[] getCustomer() {
return clients;
}
open String getBankname() {
return bankName;
}
}
Account class:
open unique class Account {
ensured twofold adjust = 0;
secured String accountId;
open Account() {}/Defaultkonstruktor
open Account(double bal, String id) {/Konstruktor
in the event that (adjust >= 0) {
adjust = bal;
}
else {
adjust = 0;
}
accountId = id;
}
open theoretical void deposit(double sum);
open theoretical void withdraw(double sum);
open theoretical twofold getBalance();
open theoretical String getAccountId();
open theoretical void transfer(double sum, account);
}
SavingsAccount class: (CreditAccount class is comparable)
open class SavingsAccount develops Account{
private twofold intrigue = 2.9;
open SavingsAccount() {/Konstruktor
super();
}
open SavingsAccount(double adjust, String id) {/Konstruktor
super(bal,id);
}
open void setInterest(Customer client) {
/code
}
open void setBalance(double adjust) {
/code
}
@Override
open void deposit(double sum) {
/code
}
@Override
open void withdraw(double sum) {
/code
}
@Override
open twofold getBalance(){
/code
}
@Override
open String getAccountId(){
/code
}
@Override
open void transfer(double sum, account) {
/code
}
open void setInterest(double interest){
/code
}
open twofold getInterest(){
/code
}
}
Client class:
open class Customer {
private String firstName;
private String lastName;
private String number;
private SavingsAccount account = new SavingsAccount();
private CreditAccount cAccount = new CreditAccount();
Customer(String firstName, String lastName, String number, SavingsAccount account) {
this.firstName = firstName;
this.lastName = lastName;
this.number = number;
this.account = account;
}
Customer(String firstName, String lastName, String number, CreditAccount cAccount) {
this.firstName = firstName;
this.lastName = lastName;
this.number = number;
this.cAccount = cAccount;
}
open SavingsAccount getAccount() {
return account;
}
open CreditAccount getCreditAccount() {
return cAccount;
}
}
Principle:
open static void main(String[] args) {
Scanner input = new Scanner(System.in);
int decision;
int numberOfCustomers = 0;
boolean endProgram = false;
String bankName;
System.out.print("Name of bank: ");
bankName = input.next();
Bank = new Bank(bankName);
String accountId;
SavingsAccount acc = new SavingsAccount();
Customer[] client = bank.getCustomer();
do {
System.out.println(" " + bank.getBankname() + " ");
System.out.println(" 1. See adjust ");
System.out.println(" 2. Pull back ");
System.out.println(" 3. Store ");
System.out.println(" 4. Exchange ");
System.out.println(" 5. Include intrigue ");
System.out.println(" 6. Include new client ");
System.out.println(" 7. Demonstrate clients ");
System.out.println(" 8. Change intrigue ");
System.out.println(" 0. Exit ");
decision = input.nextInt();
switch(choice) {
case 1:
/code
break;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.