JcGaming

Activity 9 by John Carl Quieta

Nov 17th, 2022
910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.17 KB | Source Code | 0 0
  1. //Activity 9 using multi-dimensional arrays on descrption instead of String
  2. public class deploy {
  3.     public static void main(String[] args) {
  4.  
  5.         String StudentName = "John Carl Quieta's Average Grade is: ";
  6.         // Grade description
  7.  
  8.         String[][] grady = { { " Excellent" }, { " Very Good" }, { " Good" }, { "Satisfactory" }, { "Passed" },
  9.                 { "Failed" } };
  10.  
  11.         /*
  12.          * this is my old method using string but now I'm using multidimensional array
  13.          * String exc = " Excellent";
  14.          * String vg = " Very Good";
  15.          * String gd = " Good";
  16.          * String satf = " Satisfactory";
  17.          * String pd = " Passed";
  18.          * String fd = " Failed";
  19.          */
  20.  
  21.         // Total grades of activities
  22.         int compiler = 100;
  23.         int activity = 100;
  24.         int assignment = 30;
  25.         int activityweek4 = 100;
  26.         int JNotes = 100;
  27.  
  28.         int totalgrades = compiler + activity + assignment + activityweek4 + JNotes;
  29.  
  30.         // My Grade
  31.  
  32.         int Scompiler = 100;
  33.         int Sactivity = 100;
  34.         int Sassignment = 30;
  35.         int Sactivityweek4 = 100;
  36.         int SJNotes = 100;
  37.  
  38.         int SGradeTotal = Scompiler + Sactivity + Sassignment + Sactivityweek4 + SJNotes;
  39.  
  40.         // Grade Equivalent and Numerical Value
  41.  
  42.         float G1 = 1.00f; // 96% to 100%
  43.         float G2 = 1.25f; // 90% to 95%
  44.         float G3 = 1.50f; // 85% to 89%
  45.         float G4 = 1.75f; // 80% to 84%
  46.         float G5 = 2.00f; // 75% to 79%
  47.         float G6 = 2.25f; // 70% to 74%
  48.         float G7 = 2.50f; // 65% to 69%
  49.         float G8 = 2.75f; // 60% to 64%
  50.         float G9 = 3.00f; // 51 to 59%
  51.         float G10 = 5.00f; // 0% to 50%
  52.  
  53.         if (SGradeTotal == totalgrades || SGradeTotal > 412.8) {
  54.             System.out.println(StudentName + String.format("%.02f", G1) + grady[0][0]);
  55.         } else if (SGradeTotal >= 387) {
  56.             System.out.println(StudentName + String.format("%.02f", G2) + grady[0][0]);
  57.         } else if (SGradeTotal >= 365.5) {
  58.             System.out.println(StudentName + String.format("%.02f", G3) + grady[0][1]);
  59.         } else if (SGradeTotal >= 344) {
  60.             System.out.println(StudentName + String.format("%.02f", G4) + grady[0][1]);
  61.         } else if (SGradeTotal >= 322) {
  62.             System.out.println(StudentName + String.format("%.02f", G5) + grady[0][2]);
  63.         } else if (SGradeTotal >= 301) {
  64.             System.out.println(StudentName + String.format("%.02f", G6) + grady[0][2]);
  65.         } else if (SGradeTotal >= 279.5) {
  66.             System.out.println(StudentName + String.format("%.02f", G7) + grady[0][3]);
  67.         } else if (SGradeTotal >= 258) {
  68.             System.out.println(StudentName + String.format("%.02f", G8) + grady[0][3]);
  69.         } else if (SGradeTotal >= 219.3) {
  70.             System.out.println(StudentName + String.format("%.02f", G9) + grady[0][4]);
  71.         } else if (SGradeTotal >= 0) {
  72.             System.out.println(StudentName + String.format("%.02f", G10) + grady[0][5]);
  73.         }
  74.         // my output should be 1.00 and description of excellent
  75.         // Submitted by John Carl Quieta
  76.         // Nov. 17, 2022
  77.     }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment