Question
Using Java Write a class called Student containing full name, student ID (8 digits), and list of courses and their corresponding grades. To represent courses
Using Java
Write a class called Student containing full name, student ID (8 digits), and list of courses and their corresponding grades. To represent courses and grades you can simply use two arrays of the same size; one being a String array for course names, the other one being an int array for grades (for simplicity assume grades are integers between 0-100) such that the first element in the grades array represents the grade for the first element in the course-name array, and so on. Assume there are at most 5 possible courses. Write a constructor(s) for the class. Write get and set methods for the class fields. Write a display() method that prints the students name on the first line of output and pairs of on the following lines. Write a toString() method that returns a String containing students full name and ID in format: name(ID), such as student1(12345678). Now, write a StudentDemo class with a main() method to run/test your program. In the main() method create two Student objects and set the following information using the implemented methods. Then, call display() and toString() for both objects. Name ID Course Names Grades student1 12345678 [CMPSC1, CMPSC2] [68, 83] student2 23456781 [CMPSC1, CMPSC2, CMPSC3] [75, 90, 95]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started