From hourly grind to yearly gold

Report a typo

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.

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);
    }
}
MathpublicSystemprivatefinalstaticshortintlongdouble

Create a free account to access the full topic