Advertisement
Guest User

Untitled

a guest
Aug 31st, 2017
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. package com.company;
  2. import java.util.Scanner;
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         double firstRow=Double.parseDouble(scanner.nextLine());
  8.         double secondRow=Double.parseDouble(scanner.nextLine());
  9.        
  10.         String thirdRow=scanner.nextLine();
  11.        
  12.         double priceJ=0;                      
  13.         double totalUchastnici=firstRow+secondRow;
  14.        
  15.         switch(thirdRow){
  16.             case "trail":
  17.                 priceJ=firstRow*5.50+secondRow*7;
  18.                
  19.                 break;
  20.             case "cross-country":
  21.  
  22.                 if(totalUchastnici>=50)
  23.                 {
  24.                     priceJ=(firstRow*8+secondRow*9.50)*0.75;                  
  25.                  
  26.                 }else
  27.                 {
  28.                     priceJ=firstRow*8+secondRow*9.50;
  29.                 }                        
  30.                 break;
  31.             case "downhill":
  32.                 priceJ=firstRow*12.25+secondRow*13.75;                
  33.                 break;
  34.             case "road":
  35.                 priceJ=firstRow*20+secondRow*21.50;;
  36.                
  37.                 break;
  38.         }
  39.         System.out.printf("%.2f",priceJ*0.95);
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement