equirements :a. Implement the class strictly according to its UML one-to-one (do not include anything extra, do not miss any data fields or methods) b. Add comments to your program (mark where data fields, constructors, getters, setters and toString() are) c. You can use the automatic generation approach for Getters, setters and toString() inEclipse. d. In getMonthlyInterestRate(), please return the monthly interest rate. DO NOT leave this method body blank! e. In getMonthlyInterest(), please returns the monthly interest (NOT THE INTEREST RATE), DO NOT leave this method body blank! f. In deposit() method, please deposit a specified amount to the account
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
in java
part 1) Write the Account class. The UML diagram of the class is represented below
Requirements
:a. Implement the class strictly according to its UML one-to-one (do not include anything extra, do not miss any data fields or methods)
c. You can use the automatic generation approach for Getters, setters and toString() inEclipse.
d. In getMonthlyInterestRate(), please return the monthly interest rate. DO NOT leave this
method body blank!
e. In getMonthlyInterest(), please returns the monthly interest (NOT THE INTEREST RATE),
DO NOT leave this method body blank!
f. In deposit() method, please deposit a specified amount to the account (Hint: balance +=
depositAmount). DO NOT leave this method body blank!
g. In withdraw() method, please withdraw a specified amount from the account (Hint:
balance -= withdrawAmount). DO NOT leave this method body blank!
h. Please use decimal to represent the annual interest rate. Example: if the annual interest
rate is 2%, please use 0.02 in the annualInterestRate data field.
a. Monthly interest is balance * Monthly Interest Rate.
b. Monthly Interest Rate is Annual Interest Rate / 12.
c. Example, if the balance is $1,000 and the annual interest rate is 0.02, the monthly
interest rate is 0.02 / 12 = 0.001666666666667 and the monthly interest is 1000 * 0.02 /
12 = 1.666666666666667.
d. When create dataCreated, use: private java.util.Date dateCreated = new
java.util.Date();
part 2) : create a AccountTest class in another .jave file to test the class Account
you just created
Requirements:
a. Create an object of Account class with an account ID of 1122, a balance of $20,000,
object name is Account1.
b. Set the annualInterestRate to 0.045 using the setter of annualInterestRate.
c. Use the withdraw() method to withdraw $2,500
d. Print the balance, the monthly interest, and the date.
Step by step
Solved in 4 steps