Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner; //scanner import
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner (System.in); //scanner declaration
- //variable declaration
- String lastName;
- int hours;
- double grossPay, netPay;
- final double STD_PAYRATE = 15.50, WITHHOLDING_RATE = 0.20;
- //for user to input last name
- System.out.println("Please enter employee name: ");
- lastName = input.next();
- //for user to input hours
- System.out.println("Hours worked for employee: ");
- hours = input.nextInt();
- //calculations for gross pay and net pay
- grossPay = hours * STD_PAYRATE;
- netPay = grossPay - (grossPay * WITHHOLDING_RATE);
- //output statement to show the user their net pay
- System.out.println("Net pay for " +lastName+ "who worked for " +hours+ "hours is: $" +netPay);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement