Advertisement
Ivakis

School Camp

Oct 10th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String season = scanner.nextLine();
  8. String groupType = scanner.nextLine();
  9. int studentsCount = Integer.parseInt(scanner.nextLine());
  10. int nightsCount = Integer.parseInt(scanner.nextLine());
  11.  
  12. double pricePerNight = 0;
  13. String sport = "";
  14.  
  15. if(season.equals("Winter")){
  16. if(groupType.equals("mixed")){
  17. pricePerNight = 10;
  18. sport = "Ski";
  19. }else{
  20. if(groupType.equals("girls")){
  21. sport = "Gymnastics";
  22. }else{
  23. sport = "Judo";
  24. }
  25. pricePerNight = 9.60;
  26. }
  27. }else if(season.equals("Spring")){
  28. if(groupType.equals("mixed")){
  29. pricePerNight = 9.50;
  30. sport = "Cycling";
  31. }else{
  32. if(groupType.equals("girls")){
  33. sport = "Athletics";
  34. }else{
  35. sport = "Tennis";
  36. }
  37. pricePerNight = 7.20;
  38. }
  39. }else{
  40. if(groupType.equals("mixed")){
  41. pricePerNight = 20;
  42. sport = "Swimming";
  43. }else{
  44. if(groupType.equals("girls")){
  45. sport = "Volleyball";
  46. }else{
  47. sport = "Football";
  48. }
  49. pricePerNight = 15;
  50. }
  51. }
  52.  
  53. double price = pricePerNight * nightsCount * studentsCount;
  54.  
  55. if(studentsCount >= 10 && studentsCount < 20){
  56. price = price - price * 0.05;
  57. }else if( studentsCount >= 20 && studentsCount < 50){
  58. price = price - price * 0.15;
  59. }else if(studentsCount >= 50){
  60. price = price - price * 0.50;
  61. }
  62.  
  63. System.out.printf("%s %.2f lv.", sport, price);
  64.  
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement