首页 > > 详细

讲解programming language、辅导Java、Java编程设计调试、讲解JOptionPane 解析Java程序|解析Hask

COURSEWORK SPECIFICATION


OBJECTIVES

This assignment aims to provide you with some experience in writing codes using Java programming language that covers the following topics: Class and Objects
Remember that:
1.All programs should be able to run on the lab’s computers.
2.You must put the following information on the header of each text and source file you will be submitting in this assignment:
Student’s full name:
Student’s ID:
Modification Date:
Purpose of this file (or program):
3.Assignments that are not able to be compiled will result in zero mark given to the assignment.
4.You must only use the Java features that have already been covered in the lectures 
Question 
For this assignment, you are required to write a Java application using class to simulate the operations performed on a bank account. However, this simulation is restricted to only one or two accounts. You are not required to use any collections or array for this assignment.

You will start with creating a class called SavingsAccount to represent the savings account for a customer. A SavingsAccount object should have the following fields:

the account number
the name of the account owner
balance available
the account status (either active or inactive)
the interest rate
a monthly service charge
You are not allowed to add other fields to the class. 
The class should have the following methods:a default constructor that will initialize the account number to 99999, the name to null, the status to “active” and the remaining fields to zero. a constructor with arguments that will have parameters to receive an account number, name, and an initial deposit. The status should be set to “active” and the rest of the fields should be made zero.
mutator methods for the interest rate and the monthly service charge separately. accessor methods for each field that will return the value of the field. a method to perform withdrawal operation that receives the amount to be withdrawn. It should not perform the withdrawal if there is not enough balance in the account or the account has an “inactive” status. In either case this method should return a boolean value false to indicate an unsuccessful operation. If a withdrawal can be made, the balance should be deducted with the amount given and a boolean value true will be returned. If the balance of the account falls below RM25 after the withdrawal is done, it becomes “inactive”. a method to perform deposit operation that receives amount to be deposited to the account. It should not accept any value less than RM1.00. If the account status is “inactive” and the deposit has raise the balance above RM25, the account should be made “active” again. This method should return a boolean value true if the operation is successful and false otherwise.
?a method to perform a monthly procedure that will add to the account the interest amount and minus from the account the monthly service charge. After these operations have been done, a check should be done to the account balance to see if the status should be changed according to the same rule mentioned above.
You can use the class diagram below as guideline. However, the accessor methods are not shown in the diagram. You are required to add them yourself.
SavingsAccount

-accountNumber : int
-name : String
-balance : double
-status : String
-interestRate : double
-serviceCharge : double 
+ SavingsAccount()
+ SavingsAccount(int, String, double)
+ setInterestRate(double) : void
+ setServiceCharge(double) : void
+ withdraw(double) : boolean
+ deposit(double) : boolean
+ monthlyProcedure() : void
//accessor methods for each fields
Next, write a class called AccountApp that will have a main() method to perform the simulation of the account operations. You should provide a menu for the user to choose from. A sample menu is shown below: 
Main Menu
1– Create a new account
2– Deposit
3– Withdraw
4– Monthly Procedure
0 – Exit
Enter your option: 
Allow the user to repeatedly perform various operations until the user chooses to exit from the application.

Make sure you include necessary validations in your SavingsAccount class and main() method. Use meaningful comments and identifiers in your code. Avoid repetitive codes as much as possible and make your program readable. You should also be creative in presenting your output. You may display your output on the console or use JOptionPane dialog boxes.

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!