Question: Object Oriented Programming 14011102-4 Lab#4 (((solve it with java language))) in a simple code : Task 1: Create a new class called Citizen with two
Object Oriented Programming 14011102-4
Lab#4 (((solve it with java language))) in a simple code :
Task 1:
Create a new class called Citizen with two data members:
The citizen name (name) as a String.
The citizen national ID number (ID) as a long
Note that all data members should be declared private and you can add any needed constructors and methods.
Task 2:
Create a new class called Student.
This class should have the following data members:
The student information (citizen) as an object from the type Citizen.
The Student number (ID) as a long.
The Student GPA (GPA) as a double.
Again all data members must be private. The class must also have 2 constructors and a printing method
The first constructor takes the Student ID and citizen information as parameters and assign them to the data members ID and citizen
The second constructor takes the Student ID, citizen information and GPA as parameters and assign them to the data members ID, citizen and GPA
All the parameters must have the same names as the data members they will be assigned to and identified using this.
A method called print that will print all the Student information
Task 3:
Create a new class called Students with a single data member as an array from the type Student with size 3.
Then create a method called insertStudent that return nothing and takes no argument. When this method is called it will ask the user to insert the information of a new Student (name, ID and GPA) using the keyboard and use then to create a new object form the type Student and add it to the array
Next, create a Main method at the class Students. In this method you should use for loop to call the insertStudent method 3 times in order to fill the information of all the Students. Finally use another for loop to print the information of all the Students using the print method
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
