Question
In Java Coding ! Strings and Formatting Write the program that does the following: 1. Prompts the User for their first name. 2. Prompts the
In Java Coding !
Strings and Formatting
Write the program that does the following:
1. Prompts the User for their first name.
2. Prompts the User for their last name separately from their first.
3. Prompts the User for how many hours of sleep they get per 24 hour period (this would include any naps if one is taken).
4. Prompts the User to enter how much money they would like to earn per hour.
5. Extract the first initial of the first name and convert it to a lower case. You must convert - don't try to avoid this by entering the name with a lower case for the first character.
6. Extract the first initial of the last name and convert it to a lower case. You must convert - don't try to avoid this by entering the name with a lower case for the first character.
7. Compute the percentage of the number of hours in a 24 hour period the User sleeps.
8. Format this value to print as a percentage.
9. Compute a 40 hour per week salary based on the hourly rate the User entered.
10. Format the salary as currency.
11. Display the following message:
12. Test your program to make sure it displays the output as shown in step 11. NOTE: 1. Declare all variables within the data declaration section. 2 Do not get input on the same line as a variable declaration. 3. Do not place an equation for computation on the same line as declaring a variable.
Click on the "Attachment" button to upload the .java file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started