Check_stub - name = inFile.next(); name2 = inFile.next();...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; import java.lang.*; import java.io.*; import java.text.*; import java.math.*; import java.text.DecimalFormat; i public class Check_stub { public static void main(String[]args) throws FileNotFoundException { //Tells the user the purpose of the program System.out.println("*************************************************************** *"); System.out.println("** The purpose of this program is to output the "); System.out.println("** checkstub of a "); System.out.println("**"); System.out.println("*************************************************************** *"); System.out.println(); //Declare Variables String name; String name2; String SSN; double HR, HW,Overtime, GP, NP, Deduction; d //Read from a data file Scanner inFile = new Scanner(new FileReader("G:\\Payme.txt")); //Start of loop for(int i=1;i<=15;i++) { // data is stored SSN = inFile.next();
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: name = inFile.next(); name2 = inFile.next(); HR = inFile.nextDouble(); HW = inFile.nextDouble(); H // Formulas Overtime = (HR * 1.5) * (HW - 40); GP = (HR * 40) + Overtime; Deduction = (GP * .18) + (GP * .045) + (25.65 + 7.85); NP = (GP - Deduction); //Format output System.out.println(""+i+" "+name+" "+name2); System.out.println("Social Security Number: "+SSN); System.out.println(); System.out.printf("Hours Payrate : $ %10.2f %n", (HR)); System.out.printf("Hours worked : $ %10.2f %n", (HW)); System.out.printf("Overtime Pay : $ %10.2f %n", (Overtime)); System.out.printf("Gross Pay : $ %10.2f %n", (GP)); System.out.printf("Deduction : $ %10.2f %n", (Deduction)); System.out.printf("Net Pay : $ %10.2f %n", (NP)); System.out.println(); } System.out.println("Have a nice day"); } }...
View Full Document

This note was uploaded on 06/17/2011 for the course COMPUTER S 2301 taught by Professor Staff during the Spring '11 term at Kennesaw.

Page1 / 2

Check_stub - name = inFile.next(); name2 = inFile.next();...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online