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