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

Hello I am working on a Java Project where i have to make a school main frame wi

ID: 674178 • Letter: H

Question

Hello I am working on a Java Project where i have to make a school main frame with the classes: Graded Activity, Student, Course. Then an interface called Analyzable. I need a fresh set of eyes to see what i can change in these classes to have them all work together. I am running into a lot of problems! Please HELP!!

SchoolMain Class:


package schoolmain;

public class SchoolMain {
int Student;
int Course;
public class Student {

public double getStudent()

{

return Student;

}
}
public class Course {
public double getCourse()
{
return Course;
  
}
}
public static void main(String[] args) {
  
}
  
}

GradedActivity Class:

package schoolmain;
public class GradedActivity

{

private double score; // Numeric score
public void setScore(double s)

{

score = s;

}

public double getScore()

{

return score;

}
public char getGrade()

{

char letterGrade;

if (score >= 90)

letterGrade = 'A';

else if (score >= 80)

letterGrade = 'B';

else if (score >= 70)

letterGrade = 'C';

else if (score >= 60)

letterGrade = 'D';

else

letterGrade = 'F';

return letterGrade;

}

}

Student Class:

package schoolmain;
public class Student {
private String first; // first name
private String last; // last name
private String email; // email address
private int studentID; // section number

// construct a new student with given fields
public Student(String first, String last, String email, int studentID) {
this.first = first;
this.last = last;
this.email = email;
this.studentID = studentID;
}

  
public String toString() {
return studentID+ " " + first + " " + last + " " + email;
}

public static void main(String[] args) {

  
int N = Integer.parseInt(args[0]);

  
Student[] students = new Student[N];

  
for (int i = 0; i < N; i++) {
String first = Student.readString();
String last = StdIn.readString();
String email = StdIn.readString();
int studentID = StdID.readInt();
students[i] = new Student(first, last, email, studentID);
}


for (int i = 0; i < N; i++) {
for (int j = i; j > 0; j--) {
if (students[j].less(students[j-1])) {
Student swap = students[j];
students[j] = students[j-1];
students[j-1] = swap;
}
}
}
for (int i = 0; i < N; i++) {
System.out.println(students[i]);
}
}

private boolean less(Student student) {
throw new UnsupportedOperationException("Not supported yet.");
}

}

Course Class:

package schoolmain;
public class Course {
private String courseName;
private Student[]
students = new Student[100];
private int numberofStudents;

public Course(String courseName) {
this.courseName = courseName;
}

public void addStudent(String[] Student) {
students[numberofStudents] = student[];
numberofStudents++;
}

public Student[] getStudent() {
return Student;
}

public int getnumberofStudents() {
return numberofStudents;
}

public String getCourseName() {
return courseName;
}

public void dropStudent(String student) {

}
}

This is the interface:

package schoolmain;
public interface Analyzable
{
double getAverage();
GradedActivity getHighest();
GradedActivity getLowest();


public class Course implements Analyzable

{

private GradedActivity[] grades = new GradedActivity[4];

public void setLab(GradedActivity aLab)

{

grades[0] = aLab;

}

public void setPassFailExam(PassFailExam aPassFailExam)

{

grades[1]= aPassFailExam;

}

public void setEssay(Essay anEssay)

{

grades[2] = anEssay;

}

public void setFinalExam(FinalExam aFinalExam)

{

grades[3] = aFinalExam;

}

// String toSting method to set the string for output result

public String toString()

{

String str = "Lab Score: " + grades[0].getScore() +

" Grade: " + grades[0].getGrade() +

" Pass/Fail Exam Score: " + grades[1].getScore() +

" Grade: " + grades[1].getGrade() +

" Essay Score: " + grades[2].getScore() +

" Grade: " + grades[2].getGrade() +

" Final Exam Score: " + grades[3].getScore() +

" Grade: " + grades[3].getGrade();

  

  

return str;

  

}

public double getAverage()

{

double total = 0.0;

double avg = 0.0;

for(int i = 0; i< grades.length; i++)

total += grades[i];

avg = total/grades.length;

return avg;

}

public double getHighest()

{

double highest = grades[0];

for(int i = 1; i < grades.length; i++)

{

if(grades[i] > highest)

highest = grade[i];

}

  

return highest;

}

public double getLowest()

{

double lowest = grades[0];

for(int i = 1; i < grades.length; i++)

{

if(grades[i] >lowest)

lowest = grade[i];

}

return lowest;

}

@Override
public GradedActivity getHighest() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public GradedActivity getLowest() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

}
public class CourseGradesDemo

{

public static void main(String[] args)

{

CourseGrades g = new CourseGrades();//create new corsegrade object

  

GradedActivity l = new GradedActivity();//creat new grade activity object

l.setScore(85);//set score for the lab grade

  

//set score for pass fail exam grade

PassFailExam p = new PassFailExam(10, 2, 70);

  

//set score for eassy grade

Essay e = new Essay();

e.setScore(20, 19, 15, 20);//data input for score

  

//set score for Final exam grade

FinalExam fx = new FinalExam(50, 8);

  

  

g.setLab(l);//set lab score

g.setPassFailExam(p);//set pass Fail exxam score

g.setEssay(e);//set essay score

g.setFinalExam(fx);//set Final Exam score

System.out.println(g.toString());//print out the results

System.out.println("average : "+ g.getAverage() );

System.out.println("highest : "+ l.getHighest());

System.out.println("lowest : "+l.getLowest());

  

}

}
}

Explanation / Answer


public class SchoolMain {
int Student;
int Course;
public class Student {
public double getStudent()
{
return Student;
}
}
public class Course {
public double getCourse()
{
return Course;
  
}
}
public static void main(String[] args) {
  
}
  
}
public class GradedActivity
{
private double score; // Numeric score
public void setScore(double s)
{
score = s;
}
public double getScore()
{
return score;
}
public char getGrade()
{
char letterGrade;
if (score >= 90)
letterGrade = 'A';
else if (score >= 80)
letterGrade = 'B';
else if (score >= 70)
letterGrade = 'C';
else if (score >= 60)
letterGrade = 'D';
else
letterGrade = 'F';
return letterGrade;
}
}
public class Student {
private String first; // first name
private String last; // last name
private String email; // email address
private int studentID; // section number
// construct a new student with given fields
public Student(String first, String last, String email, int studentID) {
this.first = first;
this.last = last;
this.email = email;
this.studentID = studentID;
}
  
public String toString() {
return studentID+ " " + first + " " + last + " " + email;
}
public static void main(String[] args) {
  
int N = Integer.parseInt(args[0]);
  
Student[] students = new Student[N];
  
for (int i = 0; i < N; i++) {
String first = Student.readString();
String last = StdIn.readString();
String email = StdIn.readString();
int studentID = StdID.readInt();
students[i] = new Student(first, last, email, studentID);
}

for (int i = 0; i < N; i++) {
for (int j = i; j > 0; j--) {
if (students[j].less(students[j-1])) {
Student swap = students[j];
students[j] = students[j-1];
students[j-1] = swap;
}
}
}
for (int i = 0; i < N; i++) {
System.out.println(students[i]);
}
}
private boolean less(Student student) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
public class Course {
private String courseName;
private Student[]
students = new Student[100];
private int numberofStudents;
public Course(String courseName) {
this.courseName = courseName;
}
public void addStudent(String[] Student) {
students[numberofStudents] = student[];
numberofStudents++;
}
public Student[] getStudent() {
return Student;
}
public int getnumberofStudents() {
return numberofStudents;
}
public String getCourseName() {
return courseName;
}
public void dropStudent(String student) {
}
}
public interface Analyzable
{
double getAverage();
GradedActivity getHighest();
GradedActivity getLowest();

public class Course implements Analyzable
{
private GradedActivity[] grades = new GradedActivity[4];
public void setLab(GradedActivity aLab)
{
grades[0] = aLab;
}
public void setPassFailExam(PassFailExam aPassFailExam)
{
grades[1]= aPassFailExam;
}
public void setEssay(Essay anEssay)
{
grades[2] = anEssay;
}
public void setFinalExam(FinalExam aFinalExam)
{
grades[3] = aFinalExam;
}
// String toSting method to set the string for output result
public String toString()
{
String str = "Lab Score: " + grades[0].getScore() +
" Grade: " + grades[0].getGrade() +
" Pass/Fail Exam Score: " + grades[1].getScore() +
" Grade: " + grades[1].getGrade() +
" Essay Score: " + grades[2].getScore() +
" Grade: " + grades[2].getGrade() +
" Final Exam Score: " + grades[3].getScore() +
" Grade: " + grades[3].getGrade();
  
  
return str;
  
}
public double getAverage()
{
double total = 0.0;
double avg = 0.0;
for(int i = 0; i< grades.length; i++)
total += grades[i];
avg = total/grades.length;
return avg;
}
public double getHighest()
{
double highest = grades[0];
for(int i = 1; i < grades.length; i++)
{
if(grades[i] > highest)
highest = grade[i];
}
  
return highest;
}
public double getLowest()
{
double lowest = grades[0];
for(int i = 1; i < grades.length; i++)
{
if(grades[i] >lowest)
lowest = grade[i];
}
return lowest;
}
@Override
public GradedActivity getHighest() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public GradedActivity getLowest() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
public class CourseGradesDemo
{
public static void main(String[] args)
{
CourseGrades g = new CourseGrades();//create new corsegrade object
  
GradedActivity l = new GradedActivity();//creat new grade activity object
l.setScore(85);//set score for the lab grade
  
//set score for pass fail exam grade
PassFailExam p = new PassFailExam(10, 2, 70);
  
//set score for eassy grade
Essay e = new Essay();
e.setScore(20, 19, 15, 20);//data input for score
  
//set score for Final exam grade
FinalExam fx = new FinalExam(50, 8);
  
  
g.setLab(l);//set lab score
g.setPassFailExam(p);//set pass Fail exxam score
g.setEssay(e);//set essay score
g.setFinalExam(fx);//set Final Exam score
System.out.println(g.toString());//print out the results
System.out.println("average : "+ g.getAverage() );
System.out.println("highest : "+ l.getHighest());
System.out.println("lowest : "+l.getLowest());
  
}
}
}

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