Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with this coding project. All .java programs you created for this assignment can be in just one NetBeans project. 1) Define Customer.java

Please help me with this coding project.

All .java programs you created for this assignment can be in just one NetBeans project. 1) Define Customer.java according to the following class diagram and information. (6 points)

Customer

-customerID: int

- firstName: String

-lastName: String

+ Customer()

+ Customer(int, String, String)

+ getCustomerID(): int

+ setCustomerID(int)

+ getFirstName(): String

+ setFirstName(String)

+ getLastName(): String

+ setLastName(String)

+ toString(): String

the first constructor doesnt have any parameter and sets each of three instance variables to 0, null, and null, respectively;

the second constructor uses three passed-in parameters to update values of the instance variables.

toString() method return a String value for all instance variables of a Customer object. A sample return value of toString() for a Customer object is as follows.

Customer ID: 4838156 Name: John Smith

2) Define Account.java according to the following class diagram and information. (10 points)

Account

______________________________

- accountNo: int

- customer: Customer

- balance: double

______________________________

+ Account(int, Customer, double)

+ getAccountNo(): int

+ setAccountNo(int)

+ getCustomer(): Customer

+ setCustomer(Customer)

+ getBalance(): double

+ setBalance(double)

+ deposit(double)

+ withdraw(double): boolean

+ toString(): String

the constructor uses three parameters to update values for accountNo, customer, and balance.

deposit(double) uses value from the input parameter to update the existing balance (by adding the parameters amount to the existing balance).

withdraw(double) reduces the current balance by the value of the input parameter. Return true if the current balance is not less than the parameters value and then reduces the existing balance accordingly; otherwise, return false and do not update the existing balance.

toString() returns a String for all instance variable values of an Account object. A sample return value of toString() for an Order object is as follows.

Customer ID: 4838156 Name: John Smith Account Number: 5820389 Balance: $5,280.05

3) Define AccountApp.java according to following requirements to interact with the Customer and Account classes. (6 points)

create a Customer object and make sure it has values for all its instance variables. Tip: you dont need to use Scanner to collect input from keyboard. For simplicity, you can use hard-code values for parameters.

call toString() method of Customer class and use system.out.println() to print out the returned value.

create an Account object and make sure it has values for all its instance variables. Similarly, you can use hard-code parameter values.

call deposit and withdraw methods of the Account object. Similarly, you can use hard-code parameter values as deposit and withdrawal amounts.

call toString() method of Account class and use system.out.println() to print out the returned value.

4) In the following class diagram, Account was defined in the above step 2). Now define SavingAccount.java in which (8 points)

the constructor uses four passed-in parameters to update values of all instance variables.

toString() returns a String for all instance variable values of an SavingAccount object. A sample return value of toString() for an SavingAccount object is as follows. The interest rate has three decimal places.

Customer ID: 4838156 Name: John Smith Account Number: 5820389 Balance: $5,280.05\Interest Rate: 2.750%

Account

- accountNo: int

- customer: Customer

- balance: double

+ Account(int, Customer, double)

+ getAccountNo(): int

+ setAccountNo(int)

+ getCustomer(): Customer

+ setCustomer(Customer)

+ getBalance(): double

+ setBalance(double)

+ deposit(double)

+ withdraw(double): boolean

+ toString(): String

SavingAccount

- interestRate: double

+ SavingAccount (int, Customer, double, double)

+ getInterestRate(): double + setInterestRate(double)

+ toString(): String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago