subject

Calculate salary: Generalize a program with variables and input. The program below has been generalized to read a user's input value for hourlyWage.
1. Run the program. Notice the user's input value of 10 is used. Modify that input value, and run again.
2. Generalize the program to get user input values for workHoursPerWeek and workWeeksPerYear (change those variables' initializations to 0). Run the program.
3. monthsPerYear will never change, so declare that variable as final. Use the standard for naming final variables. Ex: final int MAX_LENGTH = 99. Run the program.
4. Change the values in the input area below the program, and run the program again.
import java. util. Scanner;
public class Salary {
public static void main(String[] args) {
Scanner scnr = new Scanner(System. in);
int hourlyWage;
int workHoursPerWeek;
int workWeeksPerYear;
int monthsPerYear; // FIXME: Declare as final and use standard naming
int annualSalary;
int monthlySalary;
monthsPerYear = 12;
System. out. println("Enter hourly wage: ");
hourlyWage = scnr. nextInt();
// FIXME: Get user input values for workHoursPerWeek and workWeeksPerYear
workHoursPerWeek = 40;
workWeeksPerYear = 50;
annualSalary = hourlyWage * workHoursPerWeek * workWeeksPerYear;
System. out. print("Annual salary is: ");
System. out. println(annualSalary);
// FIXME: Change monthsPerYear to the final variable that uses the standard naming
monthlySalary = (hourlyWage * workHoursPerWeek * workWeeksPerYear) / monthsPerYear;
System. out. print("Monthly salary is: ");
System. out. println(monthlySalary);
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
question
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
You know the right answer?
Calculate salary: Generalize a program with variables and input. The program below has been genera...
Questions
question
Mathematics, 25.06.2019 09:00
question
Mathematics, 25.06.2019 09:00
Questions on the website: 13722362