Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SchoolCamp02 {
- private static String repeat(String str, int count) {
- String result = "";
- for (int i = 0; i < count; i++) {
- result += str;
- }
- return result;
- }
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- String season = console.nextLine().toLowerCase();
- String group = console.nextLine().toLowerCase();
- double schuler = Double.parseDouble(console.nextLine());
- double nights = Double.parseDouble(console.nextLine());
- double price = 0;
- double total = 0;
- String sport = "";
- if (group.equals("boys") || group.equals("girls")) {
- if (season.equals("summer")) {
- if (group.equals("boys")) {
- sport = "Football";
- } else if (group.equals("girls")) {
- sport = "Volleyball";
- }
- price = 15;
- total = schuler * price * nights;
- if (schuler >= 50) {
- total -= total * 0.5;
- } else if (schuler >= 20 && schuler < 50) {
- total -= total * 0.15;
- } else if (schuler >= 10 && schuler < 20) {
- total -= total * 0.05;
- }
- } else if (season.equals("spring")) {
- if (group.equals("boys")) {
- sport = "Tennis";
- } else if (group.equals("girls")) {
- sport = "Athletics";
- }
- price = 7.2;
- total = schuler * price * nights;
- if (schuler >= 50) {
- total -= total * 0.5;
- } else if (schuler >= 20 && schuler < 50) {
- total -= total * 0.15;
- } else if (schuler >= 10 && schuler < 20) {
- total -= total * 0.05;
- }
- } else if (season.equals("winter")) {
- if (group.equals("boys")) {
- sport = "Judo";
- } else if (group.equals("girls")) {
- sport = "Gymnastics";
- }
- price = 9.6;
- total = schuler * price * nights;
- if (schuler >= 50) {
- total -= total * 0.5;
- } else if (schuler >= 20 && schuler < 50) {
- total -= total * 0.15;
- } else if (schuler >= 10 && schuler < 20) {
- total -= total * 0.05;
- }
- }
- } else {
- if (season.equals("winter")) {
- sport = "Ski";
- price = 10;
- total = schuler * price * nights;
- if (schuler >= 50) {
- total -= total * 0.5;
- } else if (schuler >= 20 && schuler < 50) {
- total -= total * 0.15;
- } else if (schuler >= 10 && schuler < 20) {
- total -= total * 0.05;
- }
- } else if (season.equals("spring")) {
- sport = "Cycling";
- price = 9.5;
- total = schuler * price * nights;
- if (schuler >= 50) {
- total -= total * 0.5;
- } else if (schuler >= 20 && schuler < 50) {
- total -= total * 0.15;
- } else if (schuler >= 10 && schuler < 20) {
- total -= total * 0.05;
- }
- } else if (season.equals("summer")) {
- sport = "Swimming";
- price = 20;
- total = schuler * price * nights;
- if (schuler >= 50) {
- total -= total * 0.5;
- } else if (schuler >= 20 && schuler < 50) {
- total -= total * 0.15;
- } else if (schuler >= 10 && schuler < 20) {
- total -= total * 0.05;
- }
- }
- }
- System.out.printf("%s %.2f lv.", sport, total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement