Question: Complete the following tasks in Java within the lab time using NetBeans. Each task should be completed in a separate class Task 1: Write a
Complete the following tasks in Java within the lab time using NetBeans. Each task should be completed in a separate class Task 1: Write a student class that has the following attributes: The student ID as a long variable. The list of courses the student has as an array of integers with a maximum size of 5 which should contain the courses IDs The marks the student had at these courses as an array of doubles with the maximum size of 5. The number of courses the student had registered. This class should also have the following methods 1. The class must also have 2 constructors a. The first constructor is an empty default constructor. b. The second constructor takes the student ID as parameter and assign it to the data members ID. the parameter must have the same name as the data member it will be assigned to and identified using this. 2. Two getter methods for the student ID and number of courses. 3. Add a course which should receive the course ID as an argument and add it to the array. This method should also update the number of course accordingly. 4. Add a mark: this method should receive the course ID and the mark as arguments and then update the correct course mark. 5. Print: This should print each course followed by its mark in a single line followed by the next course in the next line. The method should print only the registered courses and their marks and not the entire arrays. TestStudent is a java class with a main method. In this method, you will create 2 objects form class Student and add 3 courses to the first one and 2 to the second. You should assume all the courses IDs and marks and add them to the object directly within the code without asking the user for any input. Finally you should print each student ID and the list of courses he had registered with their marks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
