Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Vacation {
  4. public static void main(String[] args) {
  5.  
  6. Scanner scan = new Scanner(System.in);
  7. int people = Integer.parseInt(scan.nextLine());
  8. String type = scan.nextLine();
  9. String day = scan.nextLine();
  10. double price = 0;
  11.  
  12. if (day.equals("Friday")) {
  13. if (type.equals("Students")) {
  14. price = 8.45;
  15. } else if (type.equals("Business")) {
  16. price = 10.90;
  17. } else if ((type.equals("Regular"))) {
  18. price = 15;
  19. }
  20. } else if (day.equals("Saturday")) {
  21. if (type.equals("Students")) {
  22. price = 9.80;
  23. } else if (type.equals("Business")) {
  24. price = 15.60;
  25. } else if ((type.equals("Regular"))) {
  26. price = 20;
  27. }
  28. } else if (day.equals("Sunday")) {
  29. if (type.equals("Students")) {
  30. price = 10.46;
  31. } else if (type.equals("Business")) {
  32. price = 16;
  33. } else if ((type.equals("Regular"))) {
  34. price = 22.50;
  35. }
  36. }
  37. price *= people;
  38.  
  39. if (type.equals("Students") && people >= 30) {
  40. price *= .85;
  41. } else if (type.equals("Business") && people >= 100) {
  42. int percentage = (10 / people) * 100;
  43. price -= price * percentage;
  44. } else if (type.equals("Regular") && (people >= 10 && people <= 20)) {
  45. price *= .95;
  46. }
  47.  
  48. System.out.printf("Total price: %.2f%n", price);
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement