Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java program Write a Student class that has the following attributes: The student ID as a long variable. The list of courses the student has

java program
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions