Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package lab4;
- import java.util.Scanner;
- /**
- *
- * @author x00101556
- */
- public class Lab4 {
- public static void main(String[] args) {
- Scanner scan = new Scanner (System.in);
- System.out.print("Please enter your employee id number: ");
- int empNum = scan.nextInt();
- System.out.print("Please enter your gross pay: ");
- double grossPay = scan.nextInt();
- System.out.print("Please enter s for single or m for married: ");
- String status = scan.next();
- char inputChar = status.charAt(0);
- scan.nextLine();
- System.out.print("Please enter your address: ");
- String address = scan.nextLine();
- final double SINGLE_TAX = 0.20;
- final double MARRIED_TAX = 0.23;
- double totalTax;
- double netPay;
- System.out.println();
- if (grossPay >= 50000 && inputChar == 'm'){
- totalTax = grossPay - 20000;
- totalTax = grossPay * MARRIED_TAX;
- System.out.println("You are married.");
- System.out.println("You're employee number is: " + empNum);
- System.out.println("You're address is: " + address);
- System.out.println("You're total gross pay is: €" + grossPay);
- System.out.println("You're total tax due is: €" + totalTax);
- netPay = grossPay - totalTax;
- System.out.println("You're total net pay is: €" + netPay);
- }
- if (grossPay >= 50000 && inputChar == 's'){
- totalTax = grossPay - 20000;
- totalTax = grossPay * SINGLE_TAX;
- System.out.println("You are single.");
- System.out.println("You're employee number is: " + empNum);
- System.out.println("You're address is: " + address);
- System.out.println("You're total gross pay is: €" + grossPay);
- System.out.println("You're total tax due is: €" + totalTax);
- netPay = grossPay - totalTax;
- System.out.println("You're total net pay is: €" + netPay);
- }
- if (grossPay < 50000 && inputChar == 'm'){
- totalTax = grossPay - 25000;
- totalTax = grossPay * MARRIED_TAX;
- System.out.println("You are married.");
- System.out.println("You're employee number is: " + empNum);
- System.out.println("You're address is: " + address);
- System.out.println("You're total gross pay is: €" + grossPay);
- System.out.println("You're total tax due is: €" + totalTax);
- netPay = grossPay - totalTax;
- System.out.println("You're total net pay is: €" + netPay);
- }
- if (grossPay < 50000 && inputChar == 's'){
- totalTax = grossPay - 25000;
- totalTax = grossPay * SINGLE_TAX;
- System.out.println("You are single.");
- System.out.println("You're employee number is: " + empNum);
- System.out.println("You're address is: " + address);
- System.out.println("You're total gross pay is: €" + grossPay);
- System.out.println("You're total tax due is: €" + totalTax);
- netPay = grossPay - totalTax;
- System.out.println("You're total net pay is: €" + netPay);
- }
- System.out.println();
- System.out.print("For security reasons please enter a password: ");
- String passwordOne = scan.nextLine();
- System.out.print("Please re-enter you're password: ");
- String passwordTwo = scan.nextLine();
- if(passwordOne.equals(passwordTwo)){
- System.out.println("You're passwords match.");
- }else{
- System.out.println("You're passwords do not match.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement