Question: I need help with getting this code to execute properly ` ` ` import java.util.Scanner; oublic class JavaExample public static void main ( String args

I need help with getting this code to execute properly ```
import java.util.Scanner;
oublic class JavaExample
public static void main(String args[])
{
/* This program assumes that the student has 6 subjects,
* thats why I have created the array of size 6. You can
* change this as per the requirement.
*/
int marks[]= new int[6];
int i;
float total=0, avg;
Scanner = new Scanner(System.in);
for(i=0; i6; i++){
System.out.print("Enter Marks of Subject"+(i+1)+":");
marks[i]= scanner.nextInt();
total = total + marks[i];
}
scanner.close();
//Calculating average here
avg = total/6;
System.out.print("The student Grade is: ");
if(avg>=80)
{
System.out.print("A");
}
else if(avg>=60 && avg80)
{
System.out.print("B");
}
else if(avg>=40 && avg60)
{
System.out.print("C");
}
else
{
System.out.print("D");
}
}
``````
import java.util.Scanner;
oublic class JavaExample
public static void main(String args[])
{
/* This program assumes that the student has 6 subjects,
* thats why I have created the array of size 6. You can
* change this as per the requirement.
*/
int marks[]= new int[6];
int i;
float total=0, avg;
Scanner = new Scanner(System.in);
for(i=0; i6; i++){
System.out.print("Enter Marks of Subject"+(i+1)+":");
marks[i]= scanner.nextInt();
total = total + marks[i];
}
scanner.close();
//Calculating average here
avg = total/6;
System.out.print("The student Grade is: ");
if(avg>=80)
{
System.out.print("A");
}
else if(avg>=60 && avg80)
{
System.out.print("B");
}
else if(avg>=40 && avg60)
{
System.out.print("C");
}
else
{
System.out.print("D");
}
}
``````
package gradecalculater;
import static org.junit_jupiter,api.Assertions.assertEquals;
import org.junit.Test;
public class IGradeCalculator {
@Test
public void test(){
gradecalculator Test = new gradecalculator();
int output = test.gradecalculator("Alphabet");
assectEquals(2, output);
}
}
```
I need help with getting this code to execute

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!