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