Design a java class "MyAccount" with the following conditions. [10 marks] 1.A private String field named cname for custo
Posted: Sun May 15, 2022 9:59 am
Design a java class "MyAccount" with
the following conditions. [10 marks]
1.A private String field named cname for customer name (Give any
default value)
2. A private double field named balance for customer account
3. A private double data field named intrate that stores default
value (2). All accounts have same intrate.
4. initialize values in default constructor.
5. Parameterized constructor creates account with specified id,
initial balance.
6. Define accessor and mutator methods for cname, balance,
intrate, make class as mutable.
7. A public method named deposit should add some amount to
balance.
8. A public withdraw method should subtract some amount from
balance.
9. A method mintrate should return monthly interest rate.
10. a method mint should return that month interest.
Write TestmyAccount class to
create instance for the above class, with cname="Kenna"
balance=$5000, intrate as 3.7%. apply $290 to withdraw from
balance and deposit $3000 and print all data by overriding
toString() method. [2 marks]
the following conditions. [10 marks]
1.A private String field named cname for customer name (Give any
default value)
2. A private double field named balance for customer account
3. A private double data field named intrate that stores default
value (2). All accounts have same intrate.
4. initialize values in default constructor.
5. Parameterized constructor creates account with specified id,
initial balance.
6. Define accessor and mutator methods for cname, balance,
intrate, make class as mutable.
7. A public method named deposit should add some amount to
balance.
8. A public withdraw method should subtract some amount from
balance.
9. A method mintrate should return monthly interest rate.
10. a method mint should return that month interest.
Write TestmyAccount class to
create instance for the above class, with cname="Kenna"
balance=$5000, intrate as 3.7%. apply $290 to withdraw from
balance and deposit $3000 and print all data by overriding
toString() method. [2 marks]