Професионална програма
Loading...
yocalee avatar yocalee 3 Точки

03. World Snooker Championship - Exam Preparation

Judge ми дава 90/100.

Кодът ми се чупи на #Test 8.

Ясно е, че някой отговор не е верен, но ... хвърлете по едно око, моля. 

import java.util.Scanner;
public class Dge {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String stage=scanner.nextLine(); //“Quarter final ”, “Semi final” или “Final”
        String ticket=scanner.nextLine(); //“Standard”, “Premium” или “VIP”
        int ticketPieces=Integer.parseInt(scanner.nextLine());
        String symbol=scanner.nextLine();


        double ticketPrice=0;
        double pricewithdiscount=0.0;
        int priceperpicture=0;

       if (stage.equals("Quarter final") && ticket.equals("Standard")){
           ticketPrice=ticketPieces*55.5;
       }else if (stage.equals("Semi final") && ticket.equals("Standart")){
           ticketPrice=ticketPieces*75.88;
        }else if (stage.equals("Final") && ticket.equals("Standart")){
           ticketPrice=ticketPieces*110.10;
        }else if (stage.equals("Quarter final") && ticket.equals("Premium")){
           ticketPrice=ticketPieces*105.20;
        }else if (stage.equals("Semi final") && ticket.equals("Premium")){
            ticketPrice=ticketPieces*125.22;
        }else if (stage.equals("Final") && ticket.equals("Premium")){
            ticketPrice=ticketPieces*160.66;
        }else if (stage.equals("Quarter final") && ticket.equals("VIP")){
            ticketPrice=ticketPieces*118.90;
        }else if (stage.equals("Semi final") && ticket.equals("VIP")){
            ticketPrice=ticketPieces*300.40;
        }else if (stage.equals("Final") && ticket.equals("VIP")){
            ticketPrice=ticketPieces*400;
        }

        if (ticketPrice>4000){
            if (symbol.equals("Y")||symbol.equals("N")){
           pricewithdiscount=ticketPrice*0.75;
            System.out.printf("%.2f",pricewithdiscount);}
        }
        else if (ticketPrice<=4000 && ticketPrice>2500){
            pricewithdiscount=ticketPrice*0.9;
                     if (symbol.equals("Y")){
                          priceperpicture=ticketPieces*40;
                         double sum=pricewithdiscount+priceperpicture;
                            System.out.printf("%.2f", sum);
                    }else {
                      System.out.printf("%.2f", pricewithdiscount);
                    }
                     }
        else if (symbol.equals("N")){
        System.out.printf("%.2f", ticketPrice);}
        else if (symbol.equals("Y")){
             priceperpicture=ticketPieces*40 ;
            System.out.printf("%.2f", priceperpicture+ ticketPrice);
        }
    }}
Тагове:
0
Programming Basics with Java 27/10/2019 00:39:46
lashovski avatar lashovski 5 Точки

Здравей, 
Грешката е във втория и третия "еlse if":
->Промени текста  от "Standart" на "Standard".

Поздрави

1
yocalee avatar yocalee 3 Точки

З л а т е н   си!!! Снощи си извадих очите.

Поздрави.

1