Advertisement
Spocoman

Cat Shirt

Sep 2nd, 2024
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double sleeveSize = Double.parseDouble(scanner.nextLine()),
  7.                 frontSize = Double.parseDouble(scanner.nextLine()),
  8.                 sum = (sleeveSize * 2 + frontSize * 2) * 1.1 / 100;
  9.         String fabricTypes = scanner.nextLine(),
  10.                 tieOrNot = scanner.nextLine();
  11.  
  12.         sum *= switch (fabricTypes) {
  13.             case "Linen" -> 15;
  14.             case "Cotton" -> 12;
  15.             case "Denim" -> 20;
  16.             case "Twill" -> 16;
  17.             case "Flannel" -> 11;
  18.             default -> 0;
  19.         };
  20.  
  21.         sum += 10;
  22.  
  23.         if (tieOrNot.equals("Yes")) {
  24.             sum *= 1.2;
  25.         }
  26.  
  27.         System.out.printf("The price of the shirt is: %.2flv.\n", sum);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement