Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in java Complete the following tasks in Java within the lab time using NetBeans. Each task should be completed in a separate class Task

Write in java
image text in transcribed
image text in transcribed
Complete the following tasks in Java within the lab time using NetBeans. Each task should be completed in a separate class Task 1: Create a new class called Person with two data members: The person name (name) as a String. The ID number (ID) as a long Note that all data members should be declared private and you can add any needed constructors and methods. Create a method toStrig for this class. 5. Write a Student class that extends from the Person class and has the following attributes: 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 The number of courses the student had registered. This class should also have the following methods 1. The class must also have 2 constructors (no argument constructor and the full argument constructor) 2. AddCourse: 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. 3. AddMark: this method should receive the course ID and the mark as arguments and then update the correct course mark. 4. An override toSting method. Write a PostStudent class that extends from the Person class and has the following attributes: The list of courses the student has as an array of integers with a maximum size of 3 which should contain the courses IDs The grade that the student had at these courses as an array of String with the maximum size of 3. Grade are (Pass - Good - Very Good - Excellent) This class should also have the following methods 5. The class must also have 2 constructors (no argument constructor and the full argument constructor) 6. AddCourse: 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. 7. AddGrade: this method should receive the course ID and the grade as an arguments and then update the correct course grade. 8. An override to Sting method. Create a TestStudent which is a java class with a main method. In this method, you will: Use a loop to create several objects from the type Student and PostStudent. At every cycle, you will ask the user to inform you is it a post student or an undergraduate student. accordingly, you will need to generate a new Student object or a new PostStudent object. Ask the user to fill in all the required information (student ID, courses and marks or grad) before adding this object into an array of size 10 from the type Person. After entering the students' details (5 students for example) a new loop should print all this information, on the screen. Task 2: Create a new Course class with the attribute of: The course name (name) as a String. The course ID number (ID) as a long Note that all data members should be declared private and you can add any needed constructors and methods. Create a method to Strig for this class. Update the class Student and class PostStudent to have an array of Course objects with maximum size of 5 instead of having an array of integers that was contain courses IDs. Update the AddCourse method to receive the course object as an argument and add it to the array. Also update the implementation of add mark method and any other methods that needed to be updated based on that change. At every cycle in the main you need to create Course object and fill it (read the course ID and course name from the user and then use it to fill the student/postStudent course array by sending the object as argument to the AddCourse method). Fill all the required information (student name, id, courses and marks/grades) of the array of objects and then after entering the students' details (5 students for example) a new loop should print all this information, on the screen

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

2. Initialize (the values in ).

Answered: 1 week ago

Question

3. Maximize (the agreement function).

Answered: 1 week ago