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?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

(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.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education