Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SchoolCamp {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- String season = console.nextLine().toLowerCase();
- String group = console.nextLine().toLowerCase();
- int numberOfStudents = Integer.parseInt(console.nextLine());
- int nightsSpent = Integer.parseInt(console.nextLine());
- double discount = 0;
- if (numberOfStudents >= 50) {
- discount = 0.5;
- } else if (numberOfStudents >= 20) {
- discount = 0.15;
- } else if (numberOfStudents >= 10) {
- discount = 0.05;
- }
- double pricePerNight = 0;
- String sport = "";
- if (season.equals("winter")) {
- if (group.equals("boys") || group.equals("girls")) {
- pricePerNight = 9.60;
- } else if (group.equals("mixed")) {
- pricePerNight = 10.0;
- }
- if (group.equals("boys")) {
- sport = "Judo";
- } else if (group.equals("girls")) {
- sport = "Gymnastics";
- } else if (group.equals("mixed")) {
- sport = "Ski";
- }
- } else if (season.equals("spring")) {
- if (group.equals("boys") || group.equals("girls")) {
- pricePerNight = 7.20;
- } else if (group.equals("mixed")) {
- pricePerNight = 9.50;
- }
- if (group.equals("boys")) {
- sport = "Tennis";
- } else if (group.equals("girls")) {
- sport = "Athletics";
- } else if (group.equals("mixed")) {
- sport = "Cycling";
- }
- } else if (season.equals("summer")) {
- if (group.equals("boys") || group.equals("girls")) {
- pricePerNight = 15;
- } else if (group.equals("mixed")) {
- pricePerNight = 20;
- }
- if (group.equals("boys")) {
- sport = "Football";
- } else if (group.equals("girls")) {
- sport = "Volleyball";
- } else if (group.equals("mixed")) {
- sport = "Swimming";
- }
- }
- double totalPrice = pricePerNight * nightsSpent * numberOfStudents;
- totalPrice -= totalPrice * discount;
- System.out.printf("%s %.02f lv.", sport, totalPrice);
- // main ends here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement