Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. package jeanfrancois_o_lawnproject;
  2. import java.util.Scanner;
  3.  
  4.  
  5. public final class Jeanfrancois_o_LawnProject {
  6.  
  7. private Jeanfrancois_o_LawnProject() { }
  8.  
  9. private static final String[] MONTH_NAMES = {
  10. "January",
  11. "February",
  12. "March",
  13. "April",
  14. "May",
  15. "June",
  16. "July",
  17. "August",
  18. "September",
  19. "October",
  20. "November",
  21. "December"
  22. };
  23.  
  24.  
  25. int building;
  26. int apartment;
  27. int floor;
  28. int month;
  29. //This is to give error if your input is wrong.
  30.  
  31. @SuppressWarnings("empty-statement")
  32. public static void main(String[] args) {
  33. System.out.println("Hi and welcome to Green Lawn Properties please input the following!");
  34. Scanner olivier = new Scanner(System.in);
  35. System.out.println("What's the building number?");
  36. int building = olivier.nextInt();
  37. if ((building <= 0) || (building >= 16)) {
  38. System.out.println("Error 404 wrong building #.");
  39. return;
  40. }
  41. System.out.println("What's the apartment number?");
  42. int apartment = olivier.nextInt();
  43. if ((apartment <= 100) || (apartment >= 1513));
  44. {
  45.  
  46. System.out.println("Error 404 wrong apartment #.");
  47. return;
  48. }
  49. System.out.println("What's the month number?");
  50. int month = olivier.nextInt();
  51. if ((month < 0) || (month > 12)) {
  52. System.out.println("Error 404 wrong month #.");
  53. return;
  54. }
  55. System.out.println("What is your floor number?");
  56. int floor = olivier.nextInt();
  57. if ((floor < 0) || (floor > 4)) {
  58. System.out.println("Error 404 wrong floor #.");
  59. }
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. int cost = 0;
  68.  
  69. if (floor == 1) {
  70. cost = 650;
  71. } else if (floor == 2) {
  72. cost = 750;
  73. } else if (floor == 3) {
  74. cost = 850;
  75. }
  76.  
  77. if (building >= 1 && building <= 5) {
  78. cost += cost * 0.30;
  79. } else if (building >= 6 && building <= 10) {
  80. cost += cost * 0.20;
  81. }
  82.  
  83. if (month == 6 || month == 12) {
  84. // TODO: apply discount
  85. }
  86.  
  87. System.out.println ("Green Lawn Properties");
  88.  
  89.  
  90. System.out.println("Month: " + MONTH_NAMES[month - 1]); System.out.println("Coupon Number:!");
  91. System.out.println("Building #" + building);
  92. System.out.println("Floor #" + floor);
  93. System.out.println("Apartment #" + apartment); System.out.println("Amount due: " + cost);
  94.  
  95.  
  96.  
  97.  
  98.  
  99. olivier.close();
  100. }
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement