Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java plz C. (14 pts) Implement the class Saving. The data fields are rate representing the interest rate and nbyear representing the number of

in java plz image text in transcribed
image text in transcribed
C. (14 pts) Implement the class Saving. The data fields are rate representing the interest rate and nbyear representing the number of years. a) A constructor that initializes the rate and the year number. The rate and the nbYears must be positive. b) Write the toString() method which returns the Saving account information c) Implement the compute Interest method based on the following formula: interest = balance rate* nb of years. d) Implement the compareTo method of the "Comparable" interface. A Saving account is compared to another Saving account by comparing the rate. D. (20 pts).Implement the class Customer, Each customer has an id, a name, an array of accounts, and a counter of accounts. a) Constructor: initializes the customer information (id, name) and creates an empty array of accounts of size 10. b) addAccount(acc: Account): this method add an account to the array of customer accounts. c) getAccounts(): this method returns the array of accounts. d) Write the toString() method which returns all information of the customer. Account Customer # number: int #balance: double +Account (accNum: int, bal: double) +toString(): String +computeInterest(): double -id: int -name: String -accounts: Account -accountsCounter: int +Customer: (id: int, name: String) +addAccount (ace: Account) : void +getAccounts(): [1 Account +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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

1. What are the major sources of stress in your life?

Answered: 1 week ago