For this assignment you will be constructing 2 new classes, Project and Assignment6 which is a test driver for the class Project. (2 files)
Class Project: The Project class describes a project that people can participate in. It must have the following attributes:
name type Description
projName String name of a project
projNumber int number of a project
projLocation String location of a project
initialFunding double initial funding of a project
spending double spending of a project
currentBalance double current balance of a project
Here are the methods for class Project:
Hints: you can make use of the DecimalFormat or NumberFormat class in java.text package to format initialFunding, spending, and currentBalance, having two digits after the decimal point "$0.00".
Assignment6 Class:
The driver program will allow the user to interact with your class Project. The purpose of this class is to handle all user input and screen output. The main method should start by displaying the following menu in this format:
ChoicettActionn
------tt------n
AttAdd Projectn
DttDisplay Projectn
QttQuitn
RttAdd Expendituren
?ttDisplay Helpnn
Next, the following prompt should be displayed:
What action would you like to perform?
Read in the user input and execute the appropriate command. After the execution of each command, re-display the prompt. Commands should be accepted in both lowercase and uppercase.
Add Project
Your program should display the following prompt:
Please enter the project information:
Enter a project name:
Read in the user input. Then the following prompt:
Enter a project number:
Read in the user input. Then the following prompt:
Enter a project location:
Read in the user input. Then the following prompt:
Enter a project initial funding:
Read in the user input, and use the constructor of the Project class to initialize a new Project object, project1, and set the values read from the user input, using the mutator (setter) methods of the Project class. Note that there is only one Project object in this assignment. Thus when "Add Project" option is selected more than once, the new one overwrites the old Project object.
Display Project (option A)
Your program should display the Project information using the toString method of the Project class. The toString method is used together with System.out.print method.
Quit (aption Q)
Your program should stop executing and output nothing.
Add Expenditure (option R)
Your program should display the following prompt:
Please enter any additional expenditure:
Read in the user input and update the budget of the project accordingly by calling the addExpenditure method of the project object. If it returns false, then it should display the error message: The entered expenditure is not accepted.
Display Help (option ?)
Your program should redisplay the "choice action" menu.
Invalid Command
If an invalid command is entered, display the following line:
Unknown action
Sample Output: user input is in RED
Choice Action
------ ------
A Add Project
D Display Project
Q Quit
R Add Expenditure
? Display Help
What action would you like to perform?
A
Please enter the project information:
Enter a project name:
Helping Children Project
Enter a project number:
123
Enter a project location:
Phoenix
Enter a project initial funding:
2450000
What action would you like to perform?
d
Project Name: Helping Children Project
Project Number: 123
Project Location: Phoenix
Initial Funding $2,450,000.00
Spending $0.00
Current Balance $2,450,000.00
What action would you like to perform?
r
Please enter any additional expenditure:
3500
What action would you like to perform?
d
Project Name: Helping Children Project
Project Number: 123
Project Location: Phoenix
Initial Funding $2,450,000.00
Spending $3,500.00
Current Balance $2,446,500.00
What action would you like to perform?
r
Please enter any additional expenditure: 20000
What action would you like to perform? d
Project Name: Helping Children
Project Project Number: 123
Project Location: Phoenix
Initial Funding $2,450,000.00
Spending $23,500.00
Current Balance $2,426,500.00
What action would you like to perform?
q