Question: I cannot get this this script to produce six results and i need 3 test cases. Maybe i JUnit isnt setup correctly or something. package

I cannot get this this script to produce six results and i need 3 test cases. Maybe i JUnit isnt setup correctly or something.
package gradecalculater; public class GradeCalculator {f public String calculateGrade(int[] marks){ float total =0; for (int mark : marks){ total += mark; } float avg = total / marks.length; if (avg >=80){ return "A"; } else if (avg >=60 && avg 80){ return "B"; } else if (avg >=40 && avg 60){ return "C"; } else { return "D"; }}}
Main.java
GradeCalculator.java
JUnit.java
Problems
Javadoc
Declaration
Console
Main [Java Application] C:\Program Files \Eclipse\JavaEEDeveloper\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin
Enter Marks of Subject 1:
public class GradeCalculatorTest f
@Test
public void testCalculateGrade(){
GradeCalculator gradeCalculator = new GradeCalculator();
String grade = gradeCalculator.calculateGrade(new int[]{85,75,65,55,45,95});
assectEquals("B", grade, "The grade calculation is incorrect.");
}
}
I cannot get this this script to produce six

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!