fork download
  1. /* Abreu, Dianne
  2.  * Apo, Andrea
  3.  * Gardose, Zanetha
  4.  * Manuel, Jezariel
  5.  * Ouano, Genisha
  6.  * Padan, Rheiva
  7.  * Sepian, Rogelyn
  8.  * Tupaen, Vivien
  9.  * Faypon, Jeremy
  10.  */
  11. import java.util.Scanner;
  12. import javax.swing.*;
  13. import java.awt.*;
  14. class newspaper
  15.  
  16. {
  17. public static void main(String args[])
  18. {
  19. Scanner x=new Scanner(System.in);
  20. Scanner input=new Scanner(System.in);
  21. JOptionPane.showMessageDialog(null,"Welcome!\n");
  22. int doItAgain = 1;
  23. while(doItAgain ==1){
  24. try{
  25. int a,b,c,d=0,e,i,j,k,l,m,n;
  26. String f,g,h;
  27. String Convert;
  28. a = Integer.parseInt(JOptionPane.showInputDialog("Choices: \n\t\t[1]-Daily Newspaper\n\t\t[2]-Weekly Newspaper\nChoose the kind of newspaper you want to reserve?: " ));
  29. while(a>2||a<1)
  30. {
  31. a = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\n Please choose from the following only. \n 1-Daily Newspaper, 2-Weekly Newspaper \nChoose the kind of newspaper you want to reserve?: "));
  32. }
  33. if(a==1)
  34. {
  35.  
  36. b = Integer.parseInt(JOptionPane.showInputDialog("-----------DAILY NEWSPAPER-----------\n\n\t\tChoices: \n\t\t[1]-Manila Bulletin\n\t\t[2]-Daily Inquirer\n\t\t[3]-Philippine Star\n\t\tChoose the type of newspaper you want to reserve?: "));
  37. while(b>3||b<1)
  38. {
  39. b = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice! \n Please choose from the following only.\n\t\t[1]-Manila Bulletin\n\t\t[2]-Daily Inquirer\n\t\t[3]-Philippine Star\n\t\tChoose the type of newspaper you want to reserve?: "));
  40. }
  41. switch(b)
  42. {
  43.  
  44. case 1:
  45. {
  46. c = Integer.parseInt(JOptionPane.showInputDialog("-----------MANILA BULLETIN-----------\nChoose from the following days:\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?: "));
  47. while(c>7||c<1)
  48. {
  49. c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only.\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?: "));
  50. }
  51. if(d==0)
  52. {
  53. e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?: "));
  54. if(e==1)
  55. {
  56. d=d+1;
  57. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  58. f = JOptionPane.showInputDialog("Name: ");
  59. g = JOptionPane.showInputDialog("Year: ");
  60. h = JOptionPane.showInputDialog("Section: ");
  61. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  62. }
  63. }
  64.  
  65. break;
  66. }
  67.  
  68. case 2:
  69. {
  70. c = Integer.parseInt(JOptionPane.showInputDialog("-----------DAILY INQUIRER----------- \nChoose from the following days:\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?: "));
  71. while(c>7||c<1)
  72. {
  73. c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday.\nChoose the day of the newspaper you want to reserve?: "));
  74. }
  75. if(d==0)
  76. {
  77. e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?: "));
  78. if(e==1)
  79. {
  80. d=d+1;
  81. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  82. f = JOptionPane.showInputDialog("Name: ");
  83. g = JOptionPane.showInputDialog("Year: ");
  84. h = JOptionPane.showInputDialog("Section: ");
  85. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  86. }
  87. }
  88. break;
  89. }
  90.  
  91. case 3:
  92. {
  93. c = Integer.parseInt(JOptionPane.showInputDialog("-----------PHILIPPINE STAR-----------\nChoose from the following days:\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday \nChoose the day of the newspaper you want to reserve?: "));
  94. while(c>7||c<1)
  95. {
  96. c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only\n\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?: "));
  97. }
  98. if(d==0)
  99. {
  100. e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?: "));
  101. if(e==1)
  102. {
  103. d=d+1;
  104. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  105. f = JOptionPane.showInputDialog("Name: ");
  106. g = JOptionPane.showInputDialog("Year: ");
  107. h = JOptionPane.showInputDialog("Section: ");
  108. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  109. }
  110. }
  111. break;
  112. }
  113. }//switch
  114. }//if
  115. if(a==2)
  116. {
  117. b = Integer.parseInt(JOptionPane.showInputDialog("-----------WEEKLY NEWSPAPER----------- \nChoices: \n\t\t\t[1]-Cordillera Today\n\t\t\t[2]-Midland Courier\nChoose the type of newspaper you want to reserve?: "));
  118. while(b>2||b<1)
  119. {
  120. b = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice! \n Please choose from the following only. \n\t\t\t[1]-Cordillera Today\n\t\t\t[2]-Midland Courier\nChoose the type of newspaper you want to reserve?: "));
  121. }
  122.  
  123. switch(a)
  124. {
  125. case 1:
  126. {
  127. c = Integer.parseInt(JOptionPane.showInputDialog("-----------CORDILLERA TODAY----------- \nChoose from the following weeks: \n\t\t\t[1]-Week 1\n\t\t\t[2]-Week 2\n\t\t\t[3]-Week 3\n\t\t\t[4]-Week 4\nChoose the week of the newspaper you want to reserve?: "));
  128.  
  129. while(c>4||c<1)
  130. {
  131. c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only.\n\t\t\t[1]-Week 1\n\t\t\t[2]-Week 2\n\t\t\t[3]-Week 3\n\t\t\t[4]-Week 4\nChoose the week of the newspaper you want to reserve?: "));
  132. }
  133. if(d==0)
  134. {
  135. e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?: "));
  136. if(e==1)
  137. {
  138. d=d+1;
  139. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  140. f = JOptionPane.showInputDialog("Name: ");
  141. g = JOptionPane.showInputDialog("Year: ");
  142. h = JOptionPane.showInputDialog("Section: ");
  143. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  144. }
  145. }
  146. }
  147. case 2:
  148. {
  149. c = Integer.parseInt(JOptionPane.showInputDialog("-----------MIDLAND COURIER-----------\nChoose from the following weeks: \n\t\t\t[1]-Week 1\n\t\t\t[2]-Week 2\n\t\t\t[3]-Week 3\n\t\t\t[4]-Week 4\nChoose the week of the newspaper you want to reserve?: "));
  150.  
  151. while(c>4||c<1)
  152. {
  153. c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only.\n 1-Week 1, 2-Week 2, 3-Week 3, 4-Week 4 \nChoose the week of the newspaper you want to reserve?: "));
  154. }
  155. if(d==0)
  156. {
  157. e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?: "));
  158. if(e==1)
  159. {
  160. d=d+1;
  161. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  162. f = JOptionPane.showInputDialog("Name: ");
  163. g = JOptionPane.showInputDialog("Year: ");
  164. h = JOptionPane.showInputDialog("Section: ");
  165. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  166. }
  167. }
  168. }
  169. }//switch
  170. }//if
  171. doItAgain = Integer.parseInt(JOptionPane.showInputDialog("Want TO Try Again? : \n Input 1 to try again \n Input 0 to terminate the Program"));
  172. while(doItAgain!=1&&doItAgain!=0)
  173. {
  174. doItAgain = Integer.parseInt(JOptionPane.showInputDialog("Error!? : \n Input 1 to try again \n Input 0 to terminate the Program"));
  175. }
  176. }catch(Exception error){
  177. System.exit(0);
  178. }
  179. }//loop
  180.  
  181. }
  182. }
  183.  
Runtime error #stdin #stdout 0.4s 216128KB
stdin
Standard input is empty
stdout
Standard output is empty