Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P03_MobileOperator {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String period = scan.nextLine();
- String type = scan.nextLine();
- String internet = scan.nextLine();
- int mothsToPay = Integer.parseInt(scan.nextLine());
- double price = 0.0;
- if ("one".equals(period)) {
- switch (type) {
- 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 if ("two".equals(period)) {
- switch (type) {
- 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 ("yes".equals(internet)) {
- if (price <= 10) {
- price += 5.50;
- } else if (price <= 30) {
- price += 4.35;
- } else {
- price += 3.85;
- }
- }
- price *= mothsToPay;
- if ("two".equals(period)) {
- price -= price * 0.0375;
- }
- System.out.println(String.format("%.2f lv.", price));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment