Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Scholarship {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String product = scanner.nextLine().toLowerCase();
  8. String day = scanner.nextLine().toLowerCase();
  9. double quantity = Double.parseDouble(scanner.nextLine());
  10. double price = 0;
  11.  
  12. boolean Weekdays = day.equals("monday") || day.equals("tuesday") || day.equals("wednesday") || day.equals("thursday") || day.equals("friday");
  13. boolean Weekend = day.equals("saturday") || day.equals("sunday");
  14.  
  15. if (product.equals("banana")) {
  16. if (Weekdays) {
  17. price = 2.50;
  18. } else if (Weekend) {
  19. price = 2.70;
  20. }
  21. } else if (product.equals("apple")) {
  22. if (Weekdays) {
  23. price = 1.20;
  24. } else if (Weekend) {
  25. price = 2.25;
  26. }
  27. } else if (product.equals("orange")) {
  28. if (Weekdays) {
  29. price = 0.85;
  30. } else if (Weekend) {
  31. price = 0.90;
  32. }
  33. } else if (product.equals("grapefruit")) {
  34. if (Weekdays) {
  35. price = 1.45;
  36. } else if (Weekend) {
  37. price = 2.60;
  38. }
  39. } else if (product.equals("kiwi")) {
  40. if (Weekdays) {
  41. price = 2.70;
  42. } else if (Weekend) {
  43. price = 3.00;
  44. }
  45. } else if (product.equals("pineapple")) {
  46. if (Weekdays) {
  47. price = 5.50;
  48. } else if (Weekend) {
  49. price = 5.60;
  50. }
  51. } else if (product.equals("grapes")) {
  52. if (Weekdays) {
  53. price = 3.85;
  54. } else if (Weekend) {
  55. price = 4.20;
  56. }
  57. double result = price * quantity;
  58. System.out.println(result);
  59. } else {
  60. System.out.println("error");
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement