Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exams;
- import java.util.Scanner;
- public class salary {
- public static void main(String[] args){
- Scanner scanner = new Scanner(System.in);
- double salary = Double.parseDouble(scanner.nextLine());
- int time = Integer.parseInt(scanner.nextLine());
- String member = scanner.nextLine();
- for(int i = 1 ; i <= time; i++){
- salary += salary * 0.06;
- if(i % 5 == 0){
- salary += 100;
- }
- if(i % 10 == 0){
- salary += 100;
- }
- if(member.equals("Yes") && i % 5 != 0 && i % 10 != 0){
- salary *= 0.99;
- }
- if(salary >= 5000){
- System.out.printf("Current salary: 5000.00");
- return;
- }
- }
- System.out.printf("Current salary: %.2f%n", salary);
- System.out.printf("%d more years to max salary", ?????);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment