Ask a question from expert

Ask now

Functions Accessible to Classes and Programs

2 Pages497 Words197 Views
   

Added on  2019-09-13

Functions Accessible to Classes and Programs

   Added on 2019-09-13

BookmarkShareRelated Documents
1.Create a C++ program Create a Person class:oAdd the following variables (set access so that only this class can access them):NameCampusoInclude the following functions (do not take any user input in the functions. Pass all needed values in as parameters). Make all functions accessible to classes and programs outside the Person class:Set (mutator) functions for all variablesA display function to display the user's name and campus.In the main function:oCreate an array of Person objects. Set the size to of the array to 5.oAdd three people to the array. Do not gather user input. Instead, hard code the data. Make sure you include the name and campus for each person.oDisplay all information for each person by calling the display() function.Compile and run your code.Submit your source code as a plain text file with a .cpp extension. Make sure it compiles without error before submitting it.2.Create a C++ program Using the Person class from previous one:oModify the Person class:Set all variables so they are accessible by the Person class and all sub classes (not by any other class or program).oCreate a Student class:Student inherits from PersonAdd variables for ID and major. Set all variables so they are only accessible from the Student class.ID should be of type int.Add set functions for ID and major. Set the accessiblity so they can be accessed from anywhere.Add a function to display all information for the Student. This includes information inherited from Person.oCreate a Staff class:Staff inherits from PersonAdd variables for ID and department. Set all variables so they are only accessible from the Staff class.ID should be of type stringAdd set functions for ID and department. Set the accessibility so they can be accessed from anywhere.Add a function to display all information for the Staff member. This includes informatino inherited from Person.oIn main:Create one object of type Student and one object of type Staff.Gather all input for Student (name, campus, ID, major) from the user and use the set functions to set the values for the object..
Functions Accessible to Classes and Programs_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
C++ Programs for Vehicle Warranty, Person and Subclasses
|3
|781
|323

ATM App - Java Program for ATM Operations
|6
|769
|60

Mouse Maze Solver Program using C++ and Visual Studio
|2
|571
|280

Netbeans Project Implemented CODE: Assignment
|7
|3497
|353

Using Driver and Person Classes to Store Profile Information for the MiniNet Social Network
|5
|673
|157

BookStore Application - Assignment
|38
|4445
|25