Create a program that calculates a person's yearly salary based on their hourly rate and weekly hours worked. Fill the blanks in the code to make it work correctly, considering that there are 52 weeks in a year.
Integer types and operations
From hourly grind to yearly gold
Report a typo
Fill in the gaps with the relevant elements
class SalaryCalculator {
public void main(String[] args) {
Scanner scanner = new Scanner(.in);
System.out.print("Enter hourly rate: ");
hourlyRate = scanner.nextInt();
System.out.print("Enter weekly hours: ");
int weeklyHours = scanner.nextInt();
yearlySalary = (long) hourlyRate * weeklyHours * 52;
System.out.println("Yearly salary: $" + yearlySalary);
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.