Advertisement
Guest User

Code ni sya sa Cocktail

a guest
Oct 19th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.84 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package javaapplication1;
  7.  
  8. import java.util.Scanner;
  9. import static javafx.scene.input.KeyCode.O;
  10.  
  11. /**
  12. *
  13. * @author User
  14. */
  15. public class JavaApplication1 {
  16.  
  17. /**
  18. * @param args the command line arguments
  19. */
  20. public static void main(String[] args) {
  21. Scanner sc = new Scanner(System.in);
  22. Scanner sc1 = new Scanner(System.in);
  23. double $band= 0;
  24. double sTRF = 0;
  25.  
  26.  
  27.  
  28. System.out.println("Enter Contract Number: ");
  29. int contract = sc.nextInt();
  30. //Input sa contract
  31.  
  32.  
  33. if(contract>=10000 && contract<=99999){
  34. //inig true ni musulod sya sa mga code
  35. //nasa sulod sad ang uban input para inig dili mo true ang statement mo error sya diretso
  36.  
  37.  
  38. System.out.println("Enter First Name: ");
  39. String fName = sc1.nextLine();
  40. System.out.println("Enter Last Name: ");
  41. String lName = sc1.nextLine();
  42. //input sa name
  43.  
  44. System.out.println("Enter Month: ");
  45. int month = sc.nextInt();
  46. //input sa month
  47.  
  48. String $month = "Unknown";
  49. if(month>=1 && month<=12){
  50. //if mo true ang statement diria moproceed sya sa mga designated na mga codes apil na ang mga uban pa inputs
  51. //Reason ngano gisulod nako kay para inig false ang statement di sya mo proceed sa uban pang inputs nya mo error sya diretso
  52.  
  53.  
  54.  
  55. switch (month){
  56. case 1:
  57. $month = "January";
  58. break;
  59. case 2:
  60. $month = ("February");
  61. break;
  62. case 3:
  63. $month = ("March");
  64. break;
  65. case 4:
  66. $month = ("April");
  67. break;
  68. case 5:
  69. $month = ("May");
  70. break;
  71. case 6:
  72. $month = ("June");
  73. break;
  74. case 7:
  75. $month = ("July");
  76. break;
  77. case 8:
  78. $month = ("August");
  79. break;
  80. case 9:
  81. $month = ("September");
  82. break;
  83. case 10:
  84. $month = ("October");
  85. break;
  86. case 11:
  87. $month = ("November");
  88. break;
  89. case 12:
  90. $month = ("December");
  91. break;
  92. default:
  93. $month = ("Error");
  94. }
  95.  
  96. System.out.println("Enter Day: ");
  97. int day = sc.nextInt();
  98.  
  99.  
  100.  
  101. System.out.println("Contract: " + contract);
  102. System.out.println("First Name: " + fName);
  103. System.out.println("Last Name: " + lName);
  104.  
  105.  
  106. if (day>=1 && day<=31){
  107.  
  108. System.out.println("Enter Year: ");
  109. int year = sc.nextInt();
  110.  
  111.  
  112. if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12){
  113. if (day>=1 && day<=31){
  114. System.out.println($month + " " + day + " " + year);
  115. }
  116. else {
  117. System.out.println("Error");
  118. }
  119. }
  120. else if (month == 4 || month == 6 || month == 9 || month == 11){
  121. if (day>=1 && day<=30){
  122. System.out.println($month + " " + day + " " + year);
  123. }
  124. else {
  125. System.out.println("Error");
  126. }
  127. }
  128. else if (month == 2) {
  129. if (day>=1 && day<=28){
  130. System.out.println($month + " " + day + " " + year);
  131. }
  132. else {
  133. System.out.println("Error");
  134.  
  135. }
  136. }
  137. else {
  138. System.out.println("Error");
  139. }
  140.  
  141.  
  142. //input sad ning sa ubos
  143. System.out.println("Enter Number of Guests: ");
  144. int guest = sc.nextInt();
  145. System.out.println("Cocktail? (Y or N): ");
  146. String cL = sc1.nextLine();
  147. System.out.println("Appetizer? (Y or N): ");
  148. String aP = sc1.nextLine();
  149. System.out.println("Dinner? (Y or N): ");
  150. String dR = sc1.nextLine();
  151. System.out.println("Band? (Y or N): ");
  152. String _band = sc1.nextLine();
  153. //nasulod sya diria kay tungod para mo error inig mali ang day pagkainput
  154.  
  155. double bguest = 5*guest;
  156.  
  157.  
  158. System.out.println("Contract: " + contract);
  159. System.out.println("First Name: " + fName);
  160. System.out.println("Last Name: " + lName);
  161. System.out.println("Guests: " + guest);
  162.  
  163.  
  164.  
  165. if (cL.equalsIgnoreCase("Yes")){
  166. cL = "Yes";
  167. }
  168. else if (cL.equalsIgnoreCase("No")){
  169. cL = "No";
  170. }
  171. else {
  172. cL = "Yes";
  173. }
  174.  
  175.  
  176.  
  177.  
  178. if (aP.equalsIgnoreCase("Yes")){
  179. aP = "Yes";}
  180. else if (aP.equalsIgnoreCase("Yes")){
  181. aP = "No";
  182. }
  183. else{
  184. aP = "Yes";
  185. }
  186.  
  187.  
  188. if (dR .equalsIgnoreCase("Yes")){
  189. dR = "Yes";
  190. }
  191.  
  192. else if (dR .equalsIgnoreCase("No")){
  193. dR = "No";
  194. }
  195. else{
  196. dR = "Yes";
  197. }
  198.  
  199.  
  200.  
  201. if (cL == "Yes" && aP == "No" && dR == "No" ){
  202. sTRF = + 15;
  203. }
  204. else if(cL == "No" && aP == "Yes" && dR == "No" ){
  205. sTRF = + 12;
  206. }
  207. else if(cL == "No" && aP == "No" && dR == "Yes" ){
  208. sTRF = + 19;
  209. }
  210. else if (cL == "Yes" && aP == "Yes" && dR == "No" ){
  211. sTRF = + 22;
  212. }
  213. else if (cL == "Yes" && aP == "No" && dR == "Yes" ){
  214. sTRF = + 26;
  215. }
  216. else if (cL == "No" && aP == "Yes" && dR == "Yes" ){
  217. sTRF = + 24;
  218. }
  219. else if (cL == "Yes" && aP == "Yes" && dR == "Yes" ){
  220. sTRF = + 36;
  221. }
  222. else {
  223. System.out.println("ERROR!");
  224. }
  225.  
  226.  
  227. if(_band.equalsIgnoreCase("Yes")){
  228. $band = + 500;
  229. }
  230.  
  231. double tRF = (bguest * sTRF) + $band;
  232. System.out.println("Total Fee Revenue: " + tRF);
  233.  
  234.  
  235.  
  236.  
  237. }
  238. else {
  239. System.out.println("Error!");
  240. }
  241. }
  242. else {
  243. System.out.println("Error!");
  244. }
  245.  
  246. }
  247. else {
  248. System.out.println("ERROR!");
  249. }
  250. }
  251. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement