Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A) Rewrite the following piece of code usinga 15 8) Rewrite the following code s

ID: 3911321 • Letter: A

Question

A) Rewrite the following piece of code usinga 15 8) Rewrite the following code snippet using a switch statement. ?E(ratings- 'E') //Sxcs 11ent 8yaten.out printint ysten.out.printin(Thia wowin la o, at." yaten.out-print 1nip " systern . out .printint-scaathing 1s wrong-" eise it (rating ad 6. Create a method that takes in three arrays, one for student names, one for test s wnd a last one for assignment mark. The method should then (a student needs 50 or more to qualify) using the following weights. 40% of the test and 60% of the assignment, finally print out whether the person qualified or not. Use the below format for you print out Name calkculate the students quaitying mark 110) Test Assignment Final Examination Lovisa John 59 52 85 45 75 Allowed 48 Denied

Explanation / Answer

A.

    public static void Display(String[] studentNames){
       int i=0;
       do{
           System.out.println(studentNames[i++]);
          
       }while(i<studentNames.length);
   }

B.

        switch(rating){
           case 'E':
           System.out.println("You must see this movie!");
           break;
           case 'A':
           System.out.println("This movie is OK, but not great");
           break;
           case 'B':
           System.out.println("Skip it!");
           break;
           default:
           System.out.println("Something is wrong.");
           break;
       }

Q.6.

Calculate1() is the required method.

Running Java code:

public class test{
   public static void main(String[] args){

      
       String[] studentNames = {"Jack","Jill","Lovisa","John","Adam","Eve"};
       double[] testMarks = {50,20,30,40,14,40};
       double[] assignmentMarks = {25,10,50,70,23,70};
       Calculate1(studentNames,testMarks,assignmentMarks);


   }

   public static void Calculate1(String[] studentNames,double[] testMarks,double[] assignmentMarks){
       System.out.println("Name Test Assignment Final Examination");
       System.out.println("---- ---- ---------- ----- -----------");

       for(int i=0;i<studentNames.length;i++){
           if(0.4*testMarks[i]+0.6*assignmentMarks[i]>=50){
               System.out.println(studentNames[i]+" "+testMarks[i]+" "+ assignmentMarks[i]+" "+ (0.4*testMarks[i]+0.6*assignmentMarks[i]) + " Allowed");      
           }
           else{
               System.out.println(studentNames[i]+" "+testMarks[i]+" "+ assignmentMarks[i]+" "+ (0.4*testMarks[i]+0.6*assignmentMarks[i]) + " Denied");

           }
       }

   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote