Advertisement
dimipan80

C#Exams 1. Volleyball (on Java Code)

Aug 21st, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class _1_Volleyball {
  4.  
  5.     public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.         Scanner scan = new Scanner(System.in);
  8.         String year = scan.next();
  9.         int holidays = scan.nextInt();
  10.         int hometownWeekends = scan.nextInt();
  11.  
  12.         int allWeekends = 48;
  13.         int normalWeekends = allWeekends - hometownWeekends;
  14.         double playTimes = hometownWeekends;
  15.         playTimes += ((double) normalWeekends * 3) / 4;
  16.         playTimes += ((double) holidays * 2) / 3;
  17.         if (year.equals("leap")) {
  18.             playTimes *= 1.15;
  19.         }
  20.  
  21.         int totalPlayDays = (int) playTimes;
  22.         System.out.println(totalPlayDays);
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement