Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Activity 9 using multi-dimensional arrays on descrption instead of String
- public class deploy {
- public static void main(String[] args) {
- String StudentName = "John Carl Quieta's Average Grade is: ";
- // Grade description
- String[][] grady = { { " Excellent" }, { " Very Good" }, { " Good" }, { "Satisfactory" }, { "Passed" },
- { "Failed" } };
- /*
- * this is my old method using string but now I'm using multidimensional array
- * String exc = " Excellent";
- * String vg = " Very Good";
- * String gd = " Good";
- * String satf = " Satisfactory";
- * String pd = " Passed";
- * String fd = " Failed";
- */
- // Total grades of activities
- int compiler = 100;
- int activity = 100;
- int assignment = 30;
- int activityweek4 = 100;
- int JNotes = 100;
- int totalgrades = compiler + activity + assignment + activityweek4 + JNotes;
- // My Grade
- int Scompiler = 100;
- int Sactivity = 100;
- int Sassignment = 30;
- int Sactivityweek4 = 100;
- int SJNotes = 100;
- int SGradeTotal = Scompiler + Sactivity + Sassignment + Sactivityweek4 + SJNotes;
- // Grade Equivalent and Numerical Value
- float G1 = 1.00f; // 96% to 100%
- float G2 = 1.25f; // 90% to 95%
- float G3 = 1.50f; // 85% to 89%
- float G4 = 1.75f; // 80% to 84%
- float G5 = 2.00f; // 75% to 79%
- float G6 = 2.25f; // 70% to 74%
- float G7 = 2.50f; // 65% to 69%
- float G8 = 2.75f; // 60% to 64%
- float G9 = 3.00f; // 51 to 59%
- float G10 = 5.00f; // 0% to 50%
- if (SGradeTotal == totalgrades || SGradeTotal > 412.8) {
- System.out.println(StudentName + String.format("%.02f", G1) + grady[0][0]);
- } else if (SGradeTotal >= 387) {
- System.out.println(StudentName + String.format("%.02f", G2) + grady[0][0]);
- } else if (SGradeTotal >= 365.5) {
- System.out.println(StudentName + String.format("%.02f", G3) + grady[0][1]);
- } else if (SGradeTotal >= 344) {
- System.out.println(StudentName + String.format("%.02f", G4) + grady[0][1]);
- } else if (SGradeTotal >= 322) {
- System.out.println(StudentName + String.format("%.02f", G5) + grady[0][2]);
- } else if (SGradeTotal >= 301) {
- System.out.println(StudentName + String.format("%.02f", G6) + grady[0][2]);
- } else if (SGradeTotal >= 279.5) {
- System.out.println(StudentName + String.format("%.02f", G7) + grady[0][3]);
- } else if (SGradeTotal >= 258) {
- System.out.println(StudentName + String.format("%.02f", G8) + grady[0][3]);
- } else if (SGradeTotal >= 219.3) {
- System.out.println(StudentName + String.format("%.02f", G9) + grady[0][4]);
- } else if (SGradeTotal >= 0) {
- System.out.println(StudentName + String.format("%.02f", G10) + grady[0][5]);
- }
- // my output should be 1.00 and description of excellent
- // Submitted by John Carl Quieta
- // Nov. 17, 2022
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment