public class StudentADT { //1. A Student class should include data attributes including a // student’s name (first, and last), a student number, //an array of 3 assignment grades, and an exam grade. private String firstName; private String lastName; private int studentNumber; private double[] assignmentGrades; private double examGrade; //the constructor StudentADT(firstNm, lastNm, stNo, asn1Grade, asn2Grade, asn3Grade, examGrade) public StudentADT(String firstNm, String lastNm, int stNo, double asn1Grade, double asn2Grade, double asn3Grade, double examGrade) { firstName = firstNm; lastName = lastNm; studentNumber = stNo; assignmentGrades = new double[3]; assignmentGrades[0] = asn1Grade; assignmentGrades[1] = asn2Grade; assignmentGrades[2] = asn3Grade; this.examGrade = examGrade; } //displayStudentRecord() – displays the student record on the console void displayStudentRecord() { System.out.println("Student Name: " + firstName + " " + lastName); System.out.println("Student Number: " + studentNumber); System.out.println("Assignment Grades -"); System.out.println("Assignment Grade 1: " + assignmentGrades[0]); System.out.println("Assignment Grade 2: " + assignmentGrades[1]); System.out.println("Assignment Grade 3: " + assignmentGrades[2]); System.out.println("Exam Grade: " + examGrade); } //changeAssignmentGradeForStudent (asnNum, grade) – adds a given number // grade to the grade of a given assignment number asnNum void changeAssignmentGradeForStudent(int asnNum, double grade) { if (asnNum == 1) { assignmentGrades[0] = grade; } else if (asnNum == 2) { assignmentGrades[1] = grade; } else if (asnNum == 3) { assignmentGrades[2] = grade; } else { System.out.println("Incorrect Assignment Number entered"); } } //changeExamGradeForStudent(grade) – adds a given number grade to the final // exam grade void changeExamGradeForStudent(double grade){ this.examGrade=grade; } } _________________________________________________________________________________________ //Exercise 2 A Student ADT test application (10 pts) public class StudentADTTester { public static void main(String[] args) { //Your algorithm creates at least one student record. StudentADT studentADT = new StudentADT("Jacob","Moses",4, 89,87,92,95); //Your algorithm calls each function at least once. studentADT.displayStudentRecord(); studentADT.changeAssignmentGradeForStudent(2,99); studentADT.changeExamGradeForStudent(98); //Your algorithm would present evidence that your // functions are working correctly or not. System.out.println("Student Name should print Jacob Moses"); System.out.println("Student Number should print 4"); System.out.println("Assignment 1 should print 89"); System.out.println("Assignment 2 should print 99 instead of 87"); System.out.println("Assignment 3 should print 92-"); System.out.println("Exam Grade should print 98 instead of 95"); studentADT.displayStudentRecord(); } }\
I have corrected the syntax error and ran the program, refer the screenshot for the output
___________________________________________________________________________________________________
public class StudentADT {
// 1. A Student class should include data attributes
including a
// student’s name (first, and last), a student
number,
// an array of 3 assignment grades, and an exam
grade.
private String firstName;
private String lastName;
private int studentNumber;
private double[] assignmentGrades;
private double examGrade;
// the constructor StudentADT(firstNm, lastNm,
stNo, asn1Grade,
// asn2Grade,asn3Grade, examGrade)
public StudentADT(String firstNm, String lastNm,
int stNo, double asn1Grade, double asn2Grade, double
asn3Grade,double examGrade) {
firstName = firstNm;
lastName = lastNm;
studentNumber = stNo;
assignmentGrades = new
double[3];
assignmentGrades[0] =
asn1Grade;
assignmentGrades[1] =
asn2Grade;
assignmentGrades[2] =
asn3Grade;
this.examGrade = examGrade;
}
// displayStudentRecord() – displays the student
record on the console
void displayStudentRecord() {
System.out.println("Student Name :
" + firstName + " " + lastName);
System.out.println("Student Number:
" + studentNumber);
System.out.println("Assignment
Grades -");
System.out.println("Assignment
Grade 1: " + assignmentGrades[0]);
System.out.println("Assignment
Grade 2: " + assignmentGrades[1]);
System.out.println("Assignment
Grade 3: " + assignmentGrades[2]);
System.out.println("Exam Grade: " +
examGrade);
}
// //changeAssignmentGradeForStudent (asnNum,
grade) – adds a given number //
// grade to the grade of a given assignment number
asnNum
void changeAssignmentGradeForStudent(int asnNum,
double grade) {
if (asnNum == 1) {
assignmentGrades[0] = grade;
} else if (asnNum == 2) {
assignmentGrades[1] = grade;
} else if (asnNum == 3) {
assignmentGrades[2] = grade;
} else {
System.out.println("Incorrect Assignment Number entered");
}
}
// //changeExamGradeForStudent(grade) – adds a
given number grade to the final
// // exam grade
void changeExamGradeForStudent(double grade) {
this.examGrade = grade;
}
}
____________________________________________________________________________________________
public class StudentADTTester {
public static void main(String[] args) {
// Your algorithm creates at
least one student record.
StudentADT studentADT = new
StudentADT("Jacob", "Moses", 4, 89, 87, 92, 95);
// Your algorithm calls each
function at least once.
studentADT.displayStudentRecord();
studentADT.changeAssignmentGradeForStudent(2, 99);
studentADT.changeExamGradeForStudent(98);
// Your algorithm would present
evidence that your
// functions are working correctly
or not.
System.out.println("Student Name
should print Jacob Moses");
System.out.println("Student Number
should print 4");
System.out.println("Assignment 1
should print 89");
System.out.println("Assignment 2
should print 99 instead of 87");
System.out.println("Assignment 3
should print 92");
System.out.println("Exam Grade
should print 98 instead of 95");
studentADT.displayStudentRecord();
}
}
______________________________________________________________________________________________
image screenshot

public class StudentADT { //1. A Student class should include data attributes including a // student’s...
Language Java Step 1: Design a class called Student. The Student class should contain the following data: firstName lastName studentID totalCredits gpa Your class should implement the “sets” and “gets” for the class. Include methods: equals, compareTo, toString. Change the toString method (from class) to put each member variable on a new line. Step 2: Write a driver program to test that Student works correctly. Test is with 3 students as given in class. Step 3: Write a “registration” program...
using basic c++ please!!!
6. (21%) Consider the following definitions class Student { class Section public: string getFirst (); string getLast (); intgetGrade () void setFirst (string s); void setLast (string s); void setGrade(int g); numStudents (); in Student getNthStudent (int n); string getCourse (); string getInstructor (); private: private: string firstName; string lastName; int Student students [SIZE]; string course; string instructor; grade ; Write a function, honorRoll that returns a dynamic array containing only those students in section sec...
Here is the code from the previous three steps:
#include <iostream>
using namespace std;
class Student
{
private:
//class variables
int ID;
string firstName,lastName;
public:
Student(int ID,string firstName,string lastName)
//constructor
{
this->ID=ID;
this->firstName=firstName;
this->lastName=lastName;
}
int getID() //getter method
{
return ID;
}
virtual string getType() = 0; //pure virtual function
virtual void printInfo() //virtual function to print basic details
of a student
{
cout << "Student type: " << getType() <<
endl;
cout << "Student ID: " << ID...
CSCI 135 Test 2 Name: 6, (21%) Consider the following definitions: class Student class Section public: string getFirst ) string getLast () int getGrade) void set First (string s) void setLast (string ) void setGrade (nt g): numStudents () Student getNthStudent (int n) string getCourse ) string getInstructor ); private: private: string firstName string lastName Student students [SIZE: string course; string structor; grade; Write a function, honorRoll that returns a dynamic array containing only those students in section sec with...
FOR JAVA: Summary: Create a program that adds students to the class list (see below). The solution should be named Roster402_v2.java. Allow the user to control the number of students added to the roster. Ask if the user would like to see their new roster to confirm additions. If yes, then display contents of the file, if no, end the program. ------------------------------------------------------------------------------------- List of student names and IDs for class (this will be your separate text file): Jones, Jim,45 Hicks,...
I have a little problem about my code. when i'm working on "toString method" in "Course" class, it always say there is a mistake, but i can not fix it: Student class: public class Student { private String firstName; private String lastName; private String id; private boolean tuitionPaid; public Student(String firstName, String lastName, String id, boolean tuitionPaid) { this.firstName=firstName; this.lastName=lastName; this.id=id; this.tuitionPaid=tuitionPaid; } ...
What is wrong with this Code? Fix the code errors to run correctly without error. There are four parts for one code, all are small code segments for one question. public class StudentTest { public static void main(String[] args){ // Part Time Student Test Student ft1 = new PartTimeStudent("George", "Bush", "123-12-5678", 1, 2 ); System.out.println(ft1); Student ft2 = new PartTimeStudent("Abraham", "Lincoln", "001-90-5323", 6, 22 ); System.out.println(ft2); // Full Time Student Test Student pt1 = new FullTimeStudent("Nikola", "Tesla", "442-00-0998", 8, 26...
Hey, need some help in Java. I'm stuck on one step that prevents me from doing the rest of the steps and need help on it. I also have a problem when I print databaseCourse and programmingCourse. instead of saying 5 and 7 respectively is shows 51 and 71. Step 8: in CourseGrades, create a method, add, that takes two parameters, studentNum and grade, and changes the grade of student studetNum to the given grade, grade. studentNum represents the student...
import java.util.Scanner; public class StudentClient { public static void main(String[] args) { Student s1 = new Student(); Student s2 = new Student("Smith", "123-45-6789", 3.2); Student s3 = new Student("Jones", "987-65-4321", 3.7); System.out.println("The name of student #1 is "); System.out.println("The social security number of student #1 is " + s1.toString()); System.out.println("Student #2 is " + s2); System.out.println("the name of student #3 is " + s3.getName()); System.out.println("The social security number...
using C++ language!! please help me out with
this homework
In this exercise, you will have to create from scratch and utilize a class called Student1430. Student 1430 has 4 private member attributes: lastName (string) firstName (string) exams (an integer array of fixed size of 4) average (double) Student1430 also has the following member functions: 1. A default constructor, which sets firstName and lastName to empty strings, and all exams and average to 0. 2. A constructor with 3 parameters:...