Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Z_Exams03;
- import java.util.Scanner;
- public class SchoolCamp {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String season = scan.nextLine().toLowerCase(); // winter , summer , spring
- String group = scan.nextLine().toLowerCase(); // boys , girls , mixed
- int studentNum = Integer.parseInt(scan.nextLine());
- int nights = Integer.parseInt(scan.nextLine());
- double priceForNight = 0;
- String sport = "";
- switch (season) {
- case "winter":
- switch (group) {
- case "boys":
- sport = "Judo";
- priceForNight = 9.60;
- break;
- case "girls":
- sport = "Gymnastics";
- priceForNight = 9.60;
- break;
- case "mixed":
- sport = "Ski";
- priceForNight = 10;
- break;
- }
- break;
- case "summer":
- switch (group) {
- case "boys":
- sport = "Football";
- priceForNight = 15;
- break;
- case "girls":
- sport = "Volleyball";
- priceForNight = 15;
- break;
- case "mixed":
- sport = "Swimming";
- priceForNight = 20;
- break;
- }
- break;
- case "spring":
- switch (group) {
- case "boys":
- sport = "Tennis";
- priceForNight = 7.20;
- break;
- case "girls":
- sport = "Athletics";
- priceForNight = 7.20;
- break;
- case "mixed":
- sport = "Cycling";
- priceForNight = 9.50;
- break;
- }
- break;
- }
- double sum = studentNum * nights * priceForNight;
- if (studentNum >= 10 && studentNum < 20) {
- System.out.printf("%s %.2f lv.", sport, sum * (1 - 0.05));
- } else if (studentNum >= 20 && studentNum < 50) {
- System.out.printf("%s %.2f lv.", sport, sum * (1 - 0.15));
- } else if (studentNum >= 50) {
- System.out.printf("%s %.2f lv.", sport, sum * (1 - 0.5));
- }else {
- System.out.printf("%s %.2f lv.", sport, sum );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement