Question: Computer science programming help Il. Write a Java source code for a class named Account. Use the Java keyword this in its TWO forms of

Computer science programming help  Computer science programming help Il. Write a Java source code for
a class named Account. Use the Java keyword this in its TWO

Il. Write a Java source code for a class named Account. Use the Java keyword this in its TWO forms of usage [(1.) to call a constructor from another constructor; and (2.) to refer to the referenced object] everywhere you need. Make sure all the data field members (data fields) are private 1. The class Account represents a typical Account (in the form of an Account Java object). Write the Account briefly described below An Account object, an instance of Account class, has the following properties and methods: state (expressed via its private data fields) is to be defined as the following Account's properties: accld, name, (of the account holder) balance, annualInterestRate, and dateCreated, and -behavior (expressed via its methods) is to withdraw, deposit and to get the monthly interest rate. (1) The Account data field accld is int, name is String, balance is double, annuallnterestRate is double and static, dateCreated is java.util.Date. (You may import the java.util library in the beginning of this Java file; then to declare this data field you will use only the data type Date. (2) Write two constructors. Use the Java this keyword to call one of the constructors from the other. The first constructor takes accld and name as formal parameters. Then, it calls the second constructor (using the Java this keyword) with the accld, name, a default balance of 0 and a default interest rate (annuallnterestRate) of 0.75 (3) The second constructor takes accld, name, balance, annualIlnterestRate as formal parameters and initializes the respective Account data fields (use this Java keyword to do this). It also should create a date of the opening of the account by initializing the dateCreated data field with the current date. (4) Implement set methods (also called mutators, setters) for the data fields' instance variables: accld, balance, and (5) Implement get methods (also called accessors, getters) for accld, name, balance, annuallnterestRate, and (6) Write the withdraw () method: It takes as a parameter an amount withdrawn and returns nothing (i.e. annualinterestRate, i.e., do not implement a set method for the dateCreated and name data field. dateCreated. void); it reduces the balance with the amount withdrawn. However, before you do this change, check if the balance is more than the amount to be withdrawn (with if statement) so that you do not end up with negative balance. Write the deposit ) method: It takes as a parameter an amount to be deposited and returns nothing; it increases the balance with the amount deposited. (7) (8) Write the getMonthlyInterest ) method: It takes no parameter and returns double; it calculates the monthly interest dollar amount gained from the interest for one month (as a real number- double). Note you must use the monthly interest rate her multiplied by the balance. (9) Include a toString () method to returnm the output for each Account in the following format (notice, this is iust an example): Accid: 123456 Name: John Smith Balance: $1,598.00 Annual Interest Rate: 2.1 Date Created: Sun Mar 25 18 (10) If you use only the data field balance (in the example above for the 1598 amount) in the tostring ) method, it will not look like a currency (money), i.e-not like above. THEREFORE, when you prepare the format of the balance, make sure that you use the NumberFormat object to print it in the format of a currency (money) value. Use this object in the following way

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!