Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Object Oriented Programming 14011102-4 Lab#4 solve it with (((java))) Task 1: Create a new class called Citizen with two data members: The citizen name (name)

Object Oriented Programming 14011102-4
Lab#4 solve it with (((java)))
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

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

3. Existing organizations and programs constrain behavior.

Answered: 1 week ago