Guest User

Untitled

a guest
Nov 12th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.17 KB | None | 0 0
  1. if(outcome1.equalsIgnoreCase("Yes")){
  2.  
  3. import java.util.Scanner; //taking input from user
  4. public class UCAS //defining class name
  5. {
  6. //Run the step1 method first
  7. public static void main (String[]args){
  8. step1();
  9. }
  10. //defining global variables + read input
  11. public static String option1 = "BTEC 90 Credit Diploma", option2 = "BTEC 90 Credit Extended Diploma", option3 = "Functional Skills", option4 = "Help", option5 = "Quit", username, finalGrade="", PASS = "P", MER = "M", DIST = "D", Stringoutline = "+-----------------------------------------------------+", outcome1="", Stringoutline2 = "+-------------------------------------------------------+";
  12. public static int P=70, M=80, D=90, FunSkillPoints=10, year1points=0, year2points=0, option, ucasPoints=0;
  13. public static Scanner userinput=new Scanner(System.in);
  14.  
  15.  
  16. /* Getting the user to make their choice for which task they wish to proceed with */
  17. public static void step1(){
  18. Scanner one = new Scanner(System.in);
  19. System.out.println("Please enter your name:" );
  20. username=userinput.next(); // getting a String value
  21. System.out.println("Welcome to Liam's JAVA program " + username + ". This program allows you to convert your grade into USCAS points.");
  22. System.out.println(username + ", please enter the number next to the task you wish to proceed with." );
  23. System.out.println(Stringoutline);
  24. System.out.println("1 |" + (option1) +" |");
  25. System.out.println("2 |" + (option2) +" |");
  26. System.out.println("3 |" + (option3) +" |");
  27. System.out.println("4 |" + (option4) +" |");
  28. System.out.println("5 |" + (option5) +" |");
  29. System.out.println(Stringoutline);
  30. option=userinput.nextInt();
  31.  
  32. if (option==5) {
  33. System.out.println("Thanks for using Liam's UCAS grade calculator.");
  34. System.exit(0);
  35. }
  36. if (option==4) {
  37. System.out.println("You have chosen the option 'help'.");
  38. helpsection();
  39. }
  40. if (option==3) {
  41. System.out.println("You have chosen the option 'functional skills'.");
  42. FunctionalSkills();
  43. }
  44. if (option==2) {
  45. System.out.println("You have chosen 'BTEC Extended Diploma'");
  46. System.out.println("Please enter the grade you got for each of the units "+(PASS)+ " " + (MER)+ " " + (DIST)+".");
  47. NinetyCredExtend();
  48. }
  49. if (option==1){
  50. System.out.println("You have chosen 'BTEC 90 Credit Diploma'");
  51. System.out.println("Please enter the grade you got for each of the units "+(PASS)+ " " + (MER)+ " " + (DIST)+".");
  52. NinetyCredCalc();
  53. }
  54. }
  55. //Getting the user to enter their grades for the extended course + calculation/ouputting their grade
  56. public static void NinetyCredExtend(){
  57. String grade;
  58. int yr2cred[] = new int[18];
  59. char year2Grades[] = new char[18];
  60.  
  61. for(int i=1; i<=18; i++){
  62. System.out.println("Please enter the grade for Unit " +i);
  63. grade=userinput.next();
  64.  
  65. year2Grades[i-1] = grade.charAt(0);
  66.  
  67. if(year2Grades[i-1] == 'P' || year2Grades[i-1] == 'p') {
  68. yr2cred[i-1] = yr2cred [i-1] + P;
  69. }
  70. if(year2Grades[i-1] == 'M' || year2Grades[i-1] == 'm') {
  71. yr2cred[i-1] = yr2cred [i-1] + M;
  72. }
  73. if(year2Grades[i-1] == 'D' || year2Grades[i-1] == 'd') {
  74. yr2cred[i-1] = yr2cred [i-1] + D;
  75. }
  76. }
  77. for(int j=0; j<18; j++){
  78. year2points = year2points + yr2cred[j];
  79. }
  80.  
  81. if(year2points<1300){
  82. finalGrade="PPP";
  83. ucasPoints=48;
  84. System.out.println(" You have scored "+year2points +" BTEC Points");
  85. }
  86. if(year2points >=1300 & year2points<1339){
  87. finalGrade="MPP";
  88. ucasPoints=64;
  89. System.out.println(" You have scored "+year2points +" BTEC Points");
  90. }
  91. if(year2points >=1340 & year2points<1379){
  92. finalGrade="MMP";
  93. ucasPoints=80;
  94. System.out.println(" You have scored "+year2points +" BTEC Points");
  95. }
  96. if(year2points >=1380 & year2points<1419){
  97. finalGrade="MMM";
  98. ucasPoints=96;
  99. System.out.println(" You have scored "+year2points +" BTEC Points");
  100. }
  101. if(year2points >=1420 & year2points<1459){
  102. finalGrade="DMM";
  103. ucasPoints=112;
  104. System.out.println(" You have scored "+year2points +" BTEC Points");
  105. }
  106. if(year2points >=1460 & year2points<1499){
  107. finalGrade="DDM";
  108. ucasPoints=128;
  109. System.out.println(" You have scored "+year2points +" BTEC Points");
  110. }
  111. if(year2points >=1500 & year2points<1529){
  112. finalGrade="DDD";
  113. ucasPoints=144;
  114. System.out.println(" You have scored "+year2points +" BTEC Points");
  115. }
  116. if(year2points >=1530 & year2points<1559){
  117. finalGrade="D*DD";
  118. ucasPoints=152;
  119. System.out.println(" You have scored "+year2points +" BTEC Points");
  120. }
  121. if(year2points >=1560 & year2points<1589){
  122. finalGrade="D*D*D";
  123. ucasPoints=160;
  124. System.out.println(" You have scored "+year2points +" BTEC Points");
  125. }
  126. if(year2points >=1590){
  127. finalGrade="D*D*D*";
  128. ucasPoints=168;
  129. System.out.println(" You have scored "+year2points +" BTEC Points");
  130. }
  131.  
  132. System.out.println("Your BTEC Grade is: "+finalGrade);
  133. System.out.println("Your UCAS Points are: "+ucasPoints);
  134. System.out.println("Do you have any Functional Skills Qualification?");
  135. System.out.println("Please enter the one of the following exactly how you see on your display 'Yes' or 'No'");
  136. outcome1=userinput.next();
  137. if(outcome1.equalsIgnoreCase("Yes")){
  138. FunctionalSkills();
  139. }
  140. if(outcome1.equalsIgnoreCase("No")){
  141. System.out.println("Thanks for using the Liam's UCAS grade calculator.");
  142. System.exit(0);
  143. }
  144. }
  145. //Getting the user to enter their grades for the 90cred course + calculation/ouputting their grade
  146. public static void NinetyCredCalc(){
  147. String grade;
  148. int yr1cred[] = new int[9];
  149. char yr1grade[] = new char[9];
  150.  
  151. for(int i=1; i<=9; i++){
  152. System.out.println("Please enter the grade for Unit " +i);
  153. grade=userinput.next();
  154.  
  155. yr1grade[i-1]=grade.charAt(0);
  156. if(yr1grade[i-1] == 'P' || yr1grade[i-1] == 'p') {
  157. yr1cred[i-1] = yr1cred [i-1] + P;
  158. }
  159. if(yr1grade[i-1] == 'M' || yr1grade[i-1] == 'm') {
  160. yr1cred[i-1] = yr1cred [i-1] + M;
  161. }
  162. if(yr1grade[i-1] == 'D' || yr1grade[i-1] == 'd') {
  163. yr1cred[i-1] = yr1cred [i-1] + D;
  164. }
  165. }
  166. for(int j=0; j<9; j++){
  167. year1points = year1points + yr1cred[j];
  168. }
  169.  
  170. if(year1points >=630 & year1points<660){
  171. finalGrade="PP";
  172. ucasPoints=32;
  173. System.out.println(" You have scored "+year1points +" BTEC Points");
  174. }
  175. if(year1points >=660 & year1points<689){
  176. finalGrade="MP";
  177. ucasPoints=48;
  178. System.out.println(" You have scored "+year1points +" BTEC Points");
  179. }
  180. if(year1points >=690 & year1points<719){
  181. finalGrade="MM";
  182. ucasPoints=64;
  183. System.out.println(" You have scored "+year1points +" BTEC Points");
  184. }
  185. if(year1points >=720 & year1points<749){
  186. finalGrade="DM";
  187. ucasPoints=80;
  188. System.out.println(" You have scored "+year1points +" BTEC Points");
  189. }
  190. if(year1points >=750 & year1points<769){
  191. finalGrade="DD";
  192. ucasPoints=96;
  193. System.out.println(" You have scored "+year1points +" BTEC Points");
  194. }
  195. if(year1points >=770 & year1points<789){
  196. finalGrade="D*D";
  197. ucasPoints=104;
  198. System.out.println(" You have scored "+year1points +" BTEC Points");
  199. }
  200. if(year1points >=790){
  201. finalGrade="D*D*";
  202. ucasPoints=112;
  203. System.out.println(" You have scored "+year1points +" BTEC Points");
  204. }
  205. System.out.println("Your BTEC Grade is: "+finalGrade);
  206. System.out.println("Your UCACs Points are: "+ucasPoints);
  207. System.out.println("Do you have one or more functional skills qualifications?");
  208. System.out.println("Please enter the one of the following exactly how you see on your display 'Yes' or 'No'");
  209. outcome1=userinput.next();
  210. if(outcome1=="Yes"){
  211. FunctionalSkills();
  212. }
  213. if(outcome1=="No"){
  214. System.out.println("Thanks for using the Liam's UCAS grade calculator.");
  215. System.exit(0);
  216. }
  217.  
  218. }
  219. //Calculation for the user to work out their FS grade
  220. public static void FunctionalSkills(){
  221. int FunctionalSkills, totalUcasPoints;
  222. System.out.println("How many functional skills Level 2 qualifications do you have? Please only enter one of the integers you see 1 or 2.)");
  223. FunctionalSkills=userinput.nextInt();
  224. if(FunctionalSkills==1) {
  225. FunctionalSkills=10;
  226. totalUcasPoints=FunctionalSkills+ucasPoints;
  227. System.out.println("Your UCAS points are: "+totalUcasPoints);
  228. System.out.println("Thanks for using Liam's UCAS grade calculator");
  229. }
  230. if(FunctionalSkills==2){
  231. FunSkillPoints=20;
  232. totalUcasPoints=FunSkillPoints+ucasPoints;
  233. System.out.println("Your UCAS points are: "+totalUcasPoints);
  234. System.out.println("Thanks for using Liam's UCAS grade calculator");
  235. }
  236. }
  237. //help section method
  238. public static void helpsection(){
  239. System.out.println("How use the program");
  240. step1();
  241. }
  242. }
Add Comment
Please, Sign In to add comment