What is the difference between an interface, class and an instance of the class? b) Is it a good idea to make member variables private? Why or why not? c) What is a constructor? Is it possible to have more than one constructor?
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
(Hand Written Submission)
Question # 1
a) What is the difference between an interface, class and an instance of the class?
b) Is it a good idea to make member variables private? Why or why not?
c) What is a constructor? Is it possible to have more than one constructor?
d) What is the difference between static data member and an instance data member?
e) What is the difference between composition and aggregation?
Question # 2
Write a program to model the kinds of people one finds in a university. The categories are students,
teachers and teaching assistant (TAs). All these categories are kinds of Person (Person is abstract class. A
teaching assistant (TA) is a student and a teacher as well.
A person has a name (string). A student has grade point average GPA (between 0 to 4), the teacher has
the number of scholarly papers he/she has published and the teacher assistant has the number of courses
he/she assists.
All the classes contain constructors with default arguments to fill all data spaces. Provide displaymethod
to print all data members of an object on the screen. Classes also contain a function called isSuccessful().
Students with a GPA over 3.5 are considered successful. Thisfunction returnstrue ifsomeone issuccessful
or false if not.
In main(), define an array of Person class, which can point to students, teachers and teacher assistants. The
program first asks the kind of person and then lets the user enter the name. For students, the program also
asks the GPA; for teacher, its ask for the number of publications and for teacher assistants it asks the
number of courses additionally.
The maximum number of object, which can be kept in the array, is 10. When the user is finished, the
program prints out the names and other data for all persons. It also prints whether a person is successful
or not. Delete the array in the end.
Output:
----------------------------------------------------------------------------------
Enter student, teacher, assistant
(s/t/a): s
Enter name: Umar
Enter GPA: 1.5
Enter another (y/n)?
y
Enter student, teacher, assistant
(s/t/a): t
Enter name: Ahmed
Enter number of publications:
75
Enter another (y/n)?
----------------------------------------------------------------------------------
1. Write all necessary classes (including their methods).
2. Write the main program which will give the above output.
3. Store the output in output.txt file using Filing.
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)