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

Has to be in Java, Asked and received answer in C++. Must ask again Program will

ID: 3532718 • Letter: H

Question

Has to be in Java, Asked and received answer in C++. Must ask again Program will use array of student objects to store and report gradebook info for users number of students.1. Ask how many students, Accept answer, 2. Prompt user to get input, a. Lastname, b.First name, c.score on each of 3 tests, Then a menu on following, Display gradebook, Display student averages, reports highest average, lists students not passing, class average on each test, and end program. Teacher is supplying the "student.class portion of the program and the methods available are in the student.class program. we are to write the student.java using Student(), and Student(String last_name, String first_name), as Constructors. Then followed by methods available String firstName(), String lastName(), int testScore(int index), double testAverage(), int maxTestScore(), boolean isPasssing(), void setTestScore(int index, int score, Last sets students score on specified test(based on index), sets to value of score.

I need response in java code, not C++.

Explanation / Answer

I hope this will help....
First rate me 5 stars.

it is fully functional code....

But doesnot tested all cases...

and plz check ispassing() fucntion as I choose 30 marsk for passing

again 5 stars



import java.io.*;

import java.util.*;


class Student

{

String first_name;

String last_name;

int t1score;

int t2score;

int t3score;

public Student()

{

first_name=null;

last_name=null;

}

public Student(String a,String b)

{

first_name=b;

last_name=a;

}

public String firstName()

{

return first_name;

}

public String lastName()

{

return last_name;

}

public int testScore(int index)

{

if(index==1)

{

return t1score;

}

else if(index==2)

{

return t2score;

}

else if(index==3)

{

return t3score;

}

else

{

return -1;

}

}

public double testAverage()

{

double avg=( t1score+t2score+t3score)/3;

return avg;

}

public int maxTestScore()

{

if((t1score>=t2score)&&(t1score>=t3score))

{

return t1score;

}

else if((t2score>=t1score)&&(t2score>=t3score))

{

return t2score;

}

else if((t3score>=t1score)&&(t3score>=t1score))

{

return t3score;

}

else

{

return -1;

}

}

public boolean isPassing()

{

if((t1score>=30)&&(t2score>=30)&&(t3score>=30))

{

return true;

}

return false;

}

public void setTestScore(int index,int score)

{

if(index==1)

{

t1score=score;

}

else if(index==2)

{

t2score=score;

}

else if(index==3)

{

t3score=score;

}

}

}





class Mukesh

{

public static void main(String args[])

{

Student S[]=new Student[100];

Scanner s=new Scanner(System.in);

System.out.print("Enter number of students");

int n=s.nextInt();

for(int i=0;i<n;i++)

{

System.out.println("ENter first name and last name");

S[i]=new Student();

S[i].first_name=s.next();

S[i].last_name=s.next();

System.out.println("Enter score on 3 tests");

S[i].t1score=s.nextInt();

S[i].t2score=s.nextInt();

S[i].t3score=s.nextInt();

}

while(1==1)

{

System.out.println("Press 0 for Display gradebook");

System.out.println("Press 1 for Display student averages");

System.out.println("Press 2 for reports highest average");

System.out.println("Press 3 for lists students not passing");

System.out.println("Press 4 for class average on each test");

System.out.println("Press 5 for quit");

int d=s.nextInt();

if(d==0)

{

System.out.println("Student name"+"First test"+" Second Test "+"Third Test");

for(int i=0;i<n;i++)

{

System.out.println(S[i].first_name+" "+S[i].last_name+" "+S[i].t1score+" "+S[i].t2score+" "+S[i].t3score+" ");

}

}

else if(d==1)

{

System.out.println("Student name averages");

for(int i=0;i<n;i++)

{

System.out.println(S[i].first_name+" "+S[i].last_name+" "+S[i].testAverage());

}

}

else if(d==2)

{

double max=0;

for(int i=0;i<n;i++)

{

if(i==0)

{

max=S[0].testAverage();

}

else

{

if(max<S[i].testAverage())

{

max=S[i].testAverage();

}

}

}

System.out.println("Highest average: "+max);

}

else if(d==3)

{

for(int i=0;i<n;i++)

{

if(!S[i].isPassing())

{

System.out.println(S[i].first_name+" "+S[i].last_name);

}

}

}

else if (d==4)

{

int t1=0;

int t2=0;

int t3=0;

for(int i=0;i<n;i++)

{

t1=t1+S[i].t1score;

t2=t2+S[i].t2score;

t3=t3+S[i].t3score;

}

System.out.println("Test 1 average:"+(t1/n));

System.out.println("Test 2 average:"+(t2/n));

System.out.println("Test 3 average:"+(t3/n));

}

else if(d==5)

{

break;

}

}

}

}

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