Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E03pastryShop {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String type = scanner.nextLine();
- double quantity = Double.parseDouble(scanner.nextLine());
- double day = Double.parseDouble(scanner.nextLine());
- double cake = 00.00;
- double souffle = 0.00;
- double baklava = 00.00;
- double sum = 0;
- double discount = 0;
- if (day <=15){
- cake = 24.00;
- souffle = 6.66;
- baklava = 12.60;
- }
- else if (day > 15){
- cake = 28.70;
- souffle = 9.80;
- baklava = 16.98;
- }
- if(type.equalsIgnoreCase("cake")){
- sum = cake * quantity;
- }
- else if (type.equalsIgnoreCase("souffle")){
- sum = souffle * quantity;
- }
- else if (type.equalsIgnoreCase("baklava")){
- sum = baklava * quantity;
- }
- if( day <= 15){
- sum *=0.90;
- }
- if (day <=22){
- if (sum <= 100 || sum <= 200){
- sum *= 0.85;
- }
- else if (sum > 200){
- sum *= 0.75;
- }
- }
- System.out.printf("%.2f", sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment