repl.it
@timmy_i_chen/

Project #6A-2

Java

No description

fork
loading
Files
  • Main.java
  • jdt.ls-java-project
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
  System.out.println("Malik Abbas");
  System.out.println("Class Code:TQS21XC-01   Pd:1");
  System.out.println("Project #3");
  System.out.println("9/13/2019");
  System.out.println("Mr.Small");


  Scanner scan = new Scanner(System.in);
  System.out.println("Enter hourly rate: ");
  double hourlyRate = scan.nextInt();
  System.out.println("Enter the number of hours worked: ");
  double hoursWorked = scan.nextInt();

  double regularWeeklyPay = hourlyRate * hoursWorked;
  double monthlyWeeklyPay = regularWeeklyPay * 4;
  double yearlyWeeklyPay = regularWeeklyPay * 52;
  double overtimeWeeklyPay = 40*hourlyRate+(hoursWorked-40)*hourlyRate*1.5;
  if(hoursWorked < 40) {
  System.out.println("Your weekly salary is "+regularWeeklyPay);
  System.out.println("your monthly salary is "+monthlyWeeklyPay);
  System.out.println("your yearly salary is "+yearlyWeeklyPay);
  }
  else {
  System.out.println("Your weekly salary is " +overtimeWeeklyPay);
  System.out.println("your monthly salary is "+overtimeWeeklyPay*4);
  System.out.println("your yearly salary is "+overtimeWeeklyPay*52);
  }
  }

}