Question: Please Help plus extra credit...step by step Tasks Another Sample Run - Non - extra Credit ( user input is shaded ) Enter your name:

Please Help plus extra credit...step by step
Tasks Another Sample Run - Non-extra Credit ( user input is shaded )
Enter your name: Montgomery Burns
Enter your age: 102
Enter how much you would like to earn a year: 12345678.9
Your name is Montgomery Burns
Your age is 102 years old which is 1224 months
You hope to earn $1.23456789E7 per year.
Sample Run --Extra Credit ( user input is shaded )
Enter your name: Wayland Smithers
Enter your age: 57
Enter how much you would like to earn a year: 13000.1
Your name is Wayland Smithers
Your age is 57 years old which is 684 months
You hope to earn $13,000.10 per year.
Grading Rubric (100 points and 5 points extra credit)
Comment in program with name (7 points)
Declaration of the variables to hold the String, int, and double entered by the user (21 points)
Declaration of the variable to hold the calculation for the calculated value (7 points)
prompting the user (Scanner or JOptionPane) for the String, int, and double(15 points)
Calculating months and storing in a variable (6 points)
Displaying the values entered back to the user along with the calculated value (console or
JOptionPane)(20 points)
JOptionPane Note: if using the JOptionPane, you need this as the last line of the main method:
System.exit(0);
For extra credit, format the salary with commas and 2 decimal points ( either using .printf or
String.format())(5 points )
following the naming guidelines for Classes and identifiers (8 points)
organization of your code( variable declaration first / prompting user for data / calculations if
applicable / then displaying the data )(8 points)
proper indenting [ right-click on code and select format ](8 points)
Declare 4 variables:
name declared as a String
ageYears declared as an int
ageMonths declared as an int
(see deviations below)
annualSalary declare as a double
(see deviations below)
Get 3 Values from the user(input):
Get the name from the user
Get the ageYears from the user
Get the annualSalary, from the user
Note: Although the declaration can be done on the same line as the getting the data from the user,
please follow the "Organization Guideline" and keep the variable declarations at the 'top' of the
main method. (See last page for a 'sample' of code organization)
Calculate 1 Value:
For ageMonths, calculate based on ageYears *12
(see deviations below)
Display Results
Display the variables along with the String literals below ( with the allowable deviations )
Allowable deviations:
for the prompt/display for age, you can ask/say something like "what age you wish you were" or
"what age do you hope to live to"
Instead of calculating months you can calculate ageDays as ageYears *365
If you do make sure your variable name reflects the data it holds
For the salary you can use a different unit of measure like per hour/per month
If you do make sure your variable name reflects the data it holds
For this lab, in NetBeans, you can name the project LabCh2, which will create the LabCh2.java file.
Sample Run - Non-extra Credit ( user input is shaded)
Enter your name: Wayland Smithers
Enter your age: 57
Enter how much you would like to earn a year: 13000.00
Please Help plus extra credit...step by step

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 Programming Questions!