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

please rewrite this code as Pseudo-Code,.. basically rewrite the code but in eng

ID: 3828480 • Letter: P

Question

please rewrite this code as Pseudo-Code,.. basically rewrite the code but in english language , Thank you so much!

class TestScores

{
private int scores[]=new int[5];
public TestScores(int test[])
{
//to validate input test score

try
{
for(int i=0;i<5;i++)
{

if (test[i]<0||test[i]>100) //condition
//Throws an exception when test score is (Score <0 || Score >100)
throw new IllegalArgumentException("Number cannot" +

" be less than 0 and greater than 100");
else

scores[i]=test[i];
}

//function call to print average

System.out.println("Your Average Test Score is:"+Average());
}

catch(IllegalArgumentException e)
{
System.out.println(e);
}
}

//function average

public double Average()
{
//variable initialized to 0
int sum=0;
double avg;
for(int i=0;i<5;i++)
{
sum+=scores[i];
}
avg=sum/5;

return avg;

}//end Average

}//end TestScores class

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import java.util.Scanner;
class TestScoresDemo
{
public static void main(String args[]) throws Exception

{
Scanner kb = new Scanner(System.in);
int array[]=new int[5];//array declaration
//inputting test scores
System.out.println("Please Enter TestScores");
for(int i=0;i<5;i++)

array[i]=kb.nextInt();//Reading array of TestScores

//Creating instance to class TestScore

TestScores t1=new TestScores(array);

System.exit(0);

}

}

Explanation / Answer

FInd below psuedocode.

1. Create the TestScores Class.
2. Declare the int scores array as Private with size 5
3. Create TestScores public method and it takes the test array with int type as argument
4. Check the test array value if the value is less than zero and greater than 100 means, then it
have to show the exception, otherwise it will add the value into scores array
5. Find the average for the scores array values.
6. In Average method returns the double value. It calculates the average for all scores.
7. Create one main method, and it will take the array values from the user and it creates the objecet for TestScores class.
8. End the program.