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. public class newspaper
  14. {
  15. public static void main(String args[])
  16. {
  17. Scanner x=new Scanner(System.in);
  18. Scanner input=new Scanner(System.in);
  19. JOptionPane.showMessageDialog(null,"Welcome!\n");
  20. int doItAgain = 1;
  21. while(doItAgain ==1){
  22. try{
  23. int a,b,c,d=0,e,i,j,k,l,m,n;
  24. String f,g,h;
  25. String Convert;
  26. 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?: " ));
  27. while(a>2||a<1)
  28. {
  29. 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?: "));
  30. }
  31. if(a==1)
  32. {
  33.  
  34. 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?: "));
  35. while(b>3||b<1)
  36. {
  37. 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?: "));
  38. }
  39. switch(b)
  40. {
  41.  
  42. case 1:
  43. {
  44. 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?: "));
  45. while(c>7||c<1)
  46. {
  47. 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?: "));
  48. }
  49. if(d==0)
  50. {
  51. 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?: "));
  52. if(e==1)
  53. {
  54. d=d+1;
  55. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  56. f = JOptionPane.showInputDialog("Name: ");
  57. g = JOptionPane.showInputDialog("Year: ");
  58. h = JOptionPane.showInputDialog("Section: ");
  59. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  60. }
  61. }
  62.  
  63. break;
  64. }
  65.  
  66. case 2:
  67. {
  68. 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?: "));
  69. while(c>7||c<1)
  70. {
  71. 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?: "));
  72. }
  73. if(d==0)
  74. {
  75. 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?: "));
  76. if(e==1)
  77. {
  78. d=d+1;
  79. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  80. f = JOptionPane.showInputDialog("Name: ");
  81. g = JOptionPane.showInputDialog("Year: ");
  82. h = JOptionPane.showInputDialog("Section: ");
  83. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  84. }
  85. }
  86. break;
  87. }
  88.  
  89. case 3:
  90. {
  91. 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?: "));
  92. while(c>7||c<1)
  93. {
  94. 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?: "));
  95. }
  96. if(d==0)
  97. {
  98. 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?: "));
  99. if(e==1)
  100. {
  101. d=d+1;
  102. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  103. f = JOptionPane.showInputDialog("Name: ");
  104. g = JOptionPane.showInputDialog("Year: ");
  105. h = JOptionPane.showInputDialog("Section: ");
  106. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  107. }
  108. }
  109. break;
  110. }
  111. }//switch
  112. }//if
  113. if(a==2)
  114. {
  115. 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?: "));
  116. while(b>2||b<1)
  117. {
  118. 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?: "));
  119. }
  120.  
  121. switch(a)
  122. {
  123. case 1:
  124. {
  125. 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?: "));
  126.  
  127. while(c>4||c<1)
  128. {
  129. 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?: "));
  130. }
  131. if(d==0)
  132. {
  133. 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?: "));
  134. if(e==1)
  135. {
  136. d=d+1;
  137. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  138. f = JOptionPane.showInputDialog("Name: ");
  139. g = JOptionPane.showInputDialog("Year: ");
  140. h = JOptionPane.showInputDialog("Section: ");
  141. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  142. }
  143. }
  144. }
  145. case 2:
  146. {
  147. 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?: "));
  148.  
  149. while(c>4||c<1)
  150. {
  151. 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?: "));
  152. }
  153. if(d==0)
  154. {
  155. 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?: "));
  156. if(e==1)
  157. {
  158. d=d+1;
  159. JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
  160. f = JOptionPane.showInputDialog("Name: ");
  161. g = JOptionPane.showInputDialog("Year: ");
  162. h = JOptionPane.showInputDialog("Section: ");
  163. JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");
  164. }
  165. }
  166. }
  167. }//switch
  168. }//if
  169. doItAgain = Integer.parseInt(JOptionPane.showInputDialog("Want TO Try Again? : \n Input 1 to try again \n Input 0 to terminate the Program"));
  170. while(doItAgain!=1&&doItAgain!=0)
  171. {
  172. doItAgain = Integer.parseInt(JOptionPane.showInputDialog("Error!? : \n Input 1 to try again \n Input 0 to terminate the Program"));
  173. }
  174. }catch(Exception error){
  175. System.exit(0);
  176. }
  177. }//loop
  178.  
  179. }
  180. }
  181.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:13: class newspaper is public, should be declared in a file named newspaper.java
public class newspaper
       ^
1 error
stdout
Standard output is empty