import java.util.Scanner; public class Salary { //Write your methods here public static void main(String[] args) { Scann

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

import java.util.Scanner; public class Salary { //Write your methods here public static void main(String[] args) { Scann

Post by answerhappygod »

import java.util.Scanner;
public class Salary {
//Write your methods here
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int hours;
double hourly_wage;
double weekly_salary = 0;
double monthly_salary = 0;
double yearly_salary = 0;
System.out.println("This program will calculate your weekly,
monthly "
+ "and yearly salary!");
System.out.print("Please enter your hourly wage: ");
hourly_wage = input.nextDouble();
System.out.print("Please enter the number of hours you work each
week: ");
hours = input.nextInt();

//call methods below
weekly_salary = //method call goes here
monthly_salary = //method call goes here
yearly_salary = //method call goes here

System.out.printf("You make $%.2f per week\n",
weekly_salary);
System.out.printf("You make $%.2f per month\n",
monthly_salary);
System.out.printf("You make $%.2f per year\n",
yearly_salary);
input.close();
}
}
weeklySalary():
monthlySalary():
yearlySalary():
weekly_salary = //method call goes here
monthly_salary = //method call goes here
yearly_salary = //method call goes here
Your output should look identical to the following (except user
input will vary):
This program will calculate your weekly, monthly, and yearly
salary!
Please enter your hourly wage: 15
Please enter the number of hours you work each week: 40
You make $600.00 per week.
You make $2400.00 per month.
You make $28800.00 per year.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply