Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package examPrep;
- import java.util.Scanner;
- public class P03MobileOperator {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String yearContract = scanner.nextLine();
- String typeContract = scanner.nextLine();
- String mobileNet = scanner.nextLine();
- int months = Integer.parseInt(scanner.nextLine());
- double amount = 0;
- if (yearContract.equals("one")) {
- if (typeContract.equals("Small")) {
- amount = 9.98;
- } else if (typeContract.equals("Middle")) {
- amount = 18.99;
- } else if (typeContract.equals("Large")) {
- amount = 25.98;
- } else if (typeContract.equals("ExtraLarge")) {
- amount = 35.99;
- }
- } else if (yearContract.equals("two")) {
- if (typeContract.equals("Small")) {
- amount = 8.58;
- } else if (typeContract.equals("Middle")) {
- amount = 17.09;
- } else if (typeContract.equals("Large")) {
- amount = 23.59;
- } else if (typeContract.equals("ExtraLarge")) {
- amount = 31.79;
- }
- }
- if (mobileNet.equals("yes")) {
- if (amount <= 10) {
- amount = amount + 5.50;
- } else if (amount <= 30) {
- amount = amount + 4.35;
- } else {
- amount = amount + 3.85;
- }
- }
- double totalSum = amount * months;
- if (yearContract.equals("two")) {
- totalSum = totalSum - (totalSum * 0.0375);
- }
- System.out.printf("%.2f lv.%n", totalSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement