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 23:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
You know the right answer?
Calculate salary: Generalize a program with variables and input. The program below has been genera...
Questions
question
Mathematics, 05.05.2020 11:33
question
Mathematics, 05.05.2020 11:33
question
Mathematics, 05.05.2020 11:33
Questions on the website: 13722363