Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class test {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double price = 0;
- String season = scanner.nextLine();
- String studentsGroup = scanner.nextLine();
- int studentsNumber = Integer.parseInt(scanner.nextLine());
- int nightsStand = Integer.parseInt(scanner.nextLine());
- switch (season) {
- case "Spring" -> {
- if (studentsGroup.equals("girls") || studentsGroup.equals("boys")) {
- price = 7.20;
- } else if (studentsGroup.equals("mixed")) {
- price = 9.50;
- }
- }
- case "Winter" -> {
- if (studentsGroup.equals("girls") || studentsGroup.equals("boys")) {
- price = 9.60;
- } else if (studentsGroup.equals("mixed")) {
- price = 10.0;
- }
- }
- case "Summer" -> {
- if (studentsGroup.equals("girls") || studentsGroup.equals("boys")) {
- price = 15.0;
- } else if (studentsGroup.equals("mixed")) {
- price = 20.0;
- }
- }
- }
- price = nightsStand * studentsNumber * price;
- if (studentsNumber >= 50) {
- price *= 0.50;
- } else if (studentsNumber >= 20) {
- price *= 0.15;
- } else if (studentsNumber >= 10) {
- price *= 0.05;
- }
- String activity = "";
- switch (studentsGroup) {
- case "girls" -> {
- switch (season) {
- case "Winter" -> activity = "Gymnastics";
- case "Spring" -> activity = "Athletics";
- case "Summer" -> activity = "Volleyball";
- }
- }
- case "boys" -> {
- switch (season) {
- case "Winter" -> activity = "Judo";
- case "Spring" -> activity = "Tennis";
- case "Summer" -> activity = "Football";
- }
- }
- case "mixed" -> {
- switch (season) {
- case "Winter" -> activity = "Ski";
- case "Spring" -> activity = "Cycling";
- case "Summer" -> activity = "Swimming";
- }
- }
- }
- System.out.printf("%s %.2f lv.", activity, price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement