Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Baklava {
- public static void main(String[] args) {
- Scanner sc =new Scanner(System.in);
- String shortcake =sc.nextLine();
- int countShortCake =Integer.parseInt(sc.nextLine());
- int randomDay =Integer.parseInt(sc.nextLine());
- double price =0.0;
- double order=0.0;
- switch(shortcake){
- case "Cake":
- if(randomDay<=15){
- price =24;
- order =countShortCake *24;
- if(order>100 && order<200){
- order=(order*0.85)-0.10*(order*0.85);
- System.out.printf("%.2f",order);
- }else if(order>200){
- order=(order*0.75)-0.10*(order*0.75);
- System.out.printf("%.2f",order);
- }
- }else if(randomDay>15){
- price=28.70;
- order=countShortCake*28.70;
- if(order>100 && order<200){
- order=(order*0.85);
- System.out.printf("%.2f",order);
- }else if(order>200){
- order=(order*0.75);
- System.out.printf("%.2f",order);
- }
- }
- break;
- case "Souffle":
- if(randomDay<=15){
- price =6.66;
- order =countShortCake*6.66;
- if(order>100 && order<200){
- order=(order*0.85)-0.10*(order*0.85);
- System.out.printf("%.2f",order);
- }else if(order>200){
- order=(order*0.75)-0.10*(order*0.75);
- System.out.printf("%.2f",order);
- }
- }else if(randomDay>15){
- price=9.80;
- order =countShortCake*9.80;
- if(order>100 && order<200){
- order=(order*0.85);
- System.out.printf("%.2f",order);
- }else if(order>200){
- order=(order*0.75);
- System.out.printf("%.2f",order);
- }
- }else if(randomDay>22){
- price=9.80;
- order =countShortCake*9.80;
- System.out.printf("%.2f",order);
- }
- break;
- case "Baklava":
- if(randomDay<=15){
- price =12.60;
- order =countShortCake *12.60;
- if(order>100 && order<200){
- order=(order*0.85)-0.10*(order*0.85);
- System.out.printf("%.2f",order);
- }else if(order>200){
- order=(order*0.75)-0.10*(order*0.75);
- System.out.printf("%.2f",order);
- }
- }else if(randomDay>15){
- price=16.98;
- order=countShortCake*16.98;
- if(order>100 && order<200){
- order=(order*0.85);
- System.out.printf("%.2f",order);
- }else if(order>200){
- order=(order*0.75);
- System.out.printf("%.2f",order);
- }
- }
- break;
- }
- //System.out.println("Hello, World!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement