Guest User

Untitled

a guest
Jan 17th, 2020
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2.  
  3. public class Enroll
  4. {
  5. public static void main(String []args)
  6. {
  7. Scanner sc = new Scanner(System.in);
  8.  
  9. int code, year =0, unit = 0, fee, bal;
  10. String name = "";
  11. Boolean result = false;
  12.  
  13. do
  14. {
  15. System.out.println("[01] Enroll now!");
  16. System.out.println("[02] View Information\n");
  17. System.out.println("[03] Print current profile\n");
  18. System.out.println("[04] Exit\n");
  19. System.out.println("\n\nEnter code: ");
  20. code = sc.nextInt();
  21.  
  22. switch (code)
  23. {
  24. case 1:
  25. result = true;
  26. System.out.println("--Enrollment Form--\n\n");
  27. System.out.print("Enter the student's name: ");
  28. sc.nextLine();
  29. name = sc.nextLine();
  30.  
  31. System.out.println("\t___________________________________________\n");
  32. System.out.println("\t| --Unit Information-- |\n");
  33. System.out.println("\t| |\n");
  34. System.out.println("\t|Year Code: Year Name: Rate per Unit:|\n");
  35. System.out.println("\t| |\n");
  36. System.out.println("\t| 1 Freshman 400.00 |\n");
  37. System.out.println("\t| 2 Sophomore 350.00 |\n");
  38. System.out.println("\t| 3 Junior 300.00 |\n");
  39. System.out.println("\t| 4&5 Senior 250.00 |\n");
  40. System.out.println("\t|_________________________________________|\n\n");
  41. System.out.println("Please enter the year code:\n");
  42. year= sc.nextInt();
  43. System.out.println("\nPlease pay the downpayment to be enrolled.\n");
  44. System.out.println("\t___________________________________________\n");
  45. System.out.println("\t| --Unit Information--|\n");
  46. System.out.println("\t| |\n");
  47. System.out.println("\t| Number of Units: Downpayment: |\n");
  48. System.out.println("\t| |\n");
  49. System.out.println("\t| 1-9 units 1000.00 |\n");
  50. System.out.println("\t| 10-15 units 1500.00 |\n");
  51. System.out.println( "\t| 16-21 units 2000.00 |\n");
  52. System.out.println("\t| above 21 units 2500.00 |\n");
  53. System.out.println("\t|_________________________________________|\n\n\n");
  54. System.out.println("\nPlease enter the the number of units to enroll on:\n");
  55. unit = sc.nextInt();
  56. break;
  57.  
  58. case 2:
  59. System.out.println("Your given information:\n");
  60. if(year==1)
  61. {
  62. fee=unit*400;
  63. bal=fee-1000;
  64. if (bal>=0)
  65. {
  66. System.out.println("Student's name: " + name );
  67. System.out.println("Year name: Freshman\n");
  68. System.out.println("Number of units enrolled: " + unit );
  69. System.out.println("Tuition Fee: " + fee + ".00" );
  70. System.out.println("Down Payment: 1000.00\n");
  71. System.out.println("Maintaining Balance: " + bal + ".00" );
  72. }
  73. else
  74. {
  75. System.out.println("Student's name: " + name );
  76. System.out.println("Year name: Freshman\n");
  77. System.out.println("Number of units enrolled: " +unit);
  78. System.out.println("Tuition Fee: " + fee + ".00" );
  79. System.out.println("Down Payment: 1000.00\n");
  80. System.out.println( "Maintaining Balance: 0.00" );
  81. }
  82. }
  83.  
  84. else if(year==2)
  85. {
  86. fee=unit*350;
  87. bal=fee-1500;
  88. if (bal>=0)
  89. {
  90. System.out.println("Student's name: " + name );
  91. System.out.println("Year name: Sophomore\n");
  92. System.out.println("Number of units enrolled: " + unit );
  93. System.out.println( "Tuition Fee: " + fee + ".00" );
  94. System.out.println( "Down Payment: 1500.00\n");
  95. System.out.println("Maintaining Balance: " + bal + ".00" );
  96. }
  97. else
  98. {
  99. System.out.println("Student's name: " + name);
  100. System.out.println( "Year name: Sophomore\n");
  101. System.out.println("Number of units enrolled: " + unit );
  102. System.out.println("Tuition Fee: " + fee + ".00");
  103. System.out.println( "Down Payment: 1500.00\n");
  104. System.out.println("Maintaining Balance: 0.00");
  105. }
  106. }
  107.  
  108. else if(year==3)
  109. {
  110. fee= unit*300;
  111. bal=fee-2000;
  112. if (bal>=0)
  113. {
  114. System.out.println("Student's name: " + name );
  115. System.out.println("Year name: Junior\n");
  116. System.out.println("Number of units enrolled: " + unit);
  117. System.out.println("Tuition Fee: " + fee +".00" );
  118. System.out.println("Down Payment: 2000.00\n");
  119. System.out.println("Maintaining Balance: " + bal + ".00");
  120. }
  121. else
  122. {
  123. System.out.println("Student's name: " + name );
  124. System.out.println("Year name: Junior\n");
  125. System.out.println("Number of units enrolled: " + unit );
  126. System.out.println("Tuition Fee: " + fee + ".00" );
  127. System.out.println("Down Payment: 2000.00\n");
  128. System.out.println("Maintaining Balance: 0.00" );
  129. }
  130. }
  131.  
  132. else if(year==4 || year==5)
  133. {
  134. fee=unit*250;
  135. bal=fee-2500;
  136. if (bal>=0)
  137. {
  138. System.out.println("Student's name: " + name );
  139. System.out.println("Year name: Senior\n");
  140. System.out.println("Number of units enrolled: " + unit );
  141. System.out.println("Tuition Fee: " + fee + ".00" );
  142. System.out.println("Down Payment: 2500.00\n");
  143. System.out.println("Maintaining Balance: " + bal + ".00" );
  144. }
  145. else
  146. {
  147. System.out.println("Student's name: " + name );
  148. System.out.println("Year Name: Senior\n");
  149. System.out.println("Number of units enrolled: " + unit );
  150. System.out.println("Tuition Fee: " + fee + ".00" );
  151. System.out.println("Down Payment: 2500.00\n");
  152. System.out.println("Maintaining Balance: 0.00" );
  153. }
  154. }
  155.  
  156. else
  157. {
  158. System.out.println("No information found.");
  159. }
  160. break;
  161. case 3:
  162. System.out.println("[01] Print the information\n");
  163. System.out.println("[02] Delete the Information\n");
  164. code = sc.nextInt();
  165. switch (code)
  166. {
  167. case 1:
  168. if (result == true)
  169. {
  170. System.out.println("Printing the information given.\n");
  171. System.out.println("The information is already printed.\n");
  172. }
  173. else
  174. {
  175. System.out.println("No Data Found!");
  176. }
  177. break;
  178. case 2:
  179. if (result == false)
  180. {
  181. System.out.println("No Data Found!");
  182. }
  183. else
  184. {
  185. System.out.println("Removing the information given.");
  186. code = 0; year = 0; unit = 0; fee = 0; bal = 0;
  187. name = "";
  188. result = false;
  189. }
  190. break;
  191. }
  192. case 4:
  193. System.out.println("Exiting...\n");
  194. break;
  195.  
  196. default:
  197. System.out.println("\nInvalid choice!\n\n");
  198. }
  199. }
  200. while(code != 4);
  201. }
  202. }
RAW Paste Data