Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int experience = Integer.parseInt((scanner.nextLine()));
- String specialty = scanner.nextLine();
- double salary = 0;
- if (specialty.equals("C# Developer"))
- salary = 5400;
- else if (specialty.equals("Java Developer"))
- salary = 5700;
- else if (specialty.equals("Front-End Web Developer"))
- salary = 4100;
- else if (specialty.equals("UX / UI Designer"))
- salary = 3100;
- else if (specialty.equals("Game Designer"))
- salary = 3600;
- if (experience <= 5)
- salary -= salary * 0.658;
- System.out.printf("Total earned money: %.2f BGN", salary * 12);
- }
- }
- ИЛИ:
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int experience = Integer.parseInt((scanner.nextLine()));
- String specialty = scanner.nextLine();
- double salary =
- switch (specialty) {
- case "C# Developer" -> 5400;
- case "Java Developer" -> 5700;
- case "Front-End Web Developer" -> 4100;
- case "UX / UI Designer" -> 3100;
- case "Game Designer" -> 3600;
- default -> 0;
- };
- if (experience <= 5)
- salary -= salary * 0.658;
- System.out.printf("Total earned money: %.2f BGN", salary * 12);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement