Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.out.println("Please enter your starting salary: ");
- double sal = in.nextInt();
- while(sal <= 0)
- {
- System.out.println("You cannot have a $0 or less salary. Please enter again: ");
- sal = in.nextInt();
- }
- //inputs and error checks
- System.out.println("Please enter your yearly percent increase: ");
- double per = in.nextInt();
- per = per / 100;
- while(per <= 0)
- {
- System.out.println("Your raise percent cannot be $0 or less. Please enter again: ");
- per = in.nextInt();
- per = per / 100;
- }
- //inputs and error checks
- System.out.println("Please enter the number of years worked: ");
- int year = in.nextInt();
- while(year <= 0)
- {
- System.out.println("You have to have worked for at least a year. Please enter again: ");
- year = in.nextInt();
- }
- //calculations and output
- for(int i=1; i<=year; i++)
- {
- while(i <= 9)
- {
- double salaryinc = per * sal;
- sal = (double)(Math.round(sal * 100)) / 100;
- System.out.println("");
- System.out.println("Year: " + i);
- System.out.println("Salary: " + sal);
- sal = sal + salaryinc;
- i++;
- }
- sal = (double)(Math.round(sal * 100)) / 100;
- System.out.println("");
- System.out.println("Salary: " + i);
- System.out.println("Salary: " + sal);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement