Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.io.*;
- public class Prog213a
- {
- public static void main(String args[])
- {
- Scanner inFile = null;
- int count = 0;
- double totalweekWage=0, sunBonus=0, extraWage=0, weekWage=0;
- double weekBonus=0, satBonus=0, sunWage=0;
- double satWage=0, normalWage=0, weekHour=0;
- try
- {
- inFile = new Scanner (new File("prog213a.dat"));
- }
- catch (FileNotFoundException e)
- {
- System.out.println ("File not found!");
- System.exit (0);
- }
- while(inFile.hasNext())
- {
- int num=inFile.nextInt();
- for(int x = 1; x <= 7; x++)
- {
- count++;
- if(x==1)
- {
- sunWage=num*10;
- sunBonus=sunWage/2;
- }
- while(x==2 || x==3 || x==4 || x==5 || x==6)
- {
- if(num>8)
- {
- normalWage=num*10;
- extraWage= (num-8)*1.50;
- }
- weekHour+=num;
- weekWage=10*weekHour;
- if(weekHour>40)
- {
- weekBonus=(weekHour-40)*2.50;
- }
- }
- if(x==7)
- {
- satWage=num*10;
- satBonus=satWage*1.25;
- }
- totalweekWage=sunWage+sunBonus+extraWage+weekWage+weekBonus+satWage+satBonus;
- System.out.println("Week # " + count + " $"+ totalweekWage);
- }
- }
- System.out.println();
- inFile.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement