Welcome

Anti Essays offers essay examples to help students with their essay writing.

Sign Up

Oop Programing Essay

Open Document

Below is an essay on "Oop Programing" from Anti Essays, your source for research papers, essays, and term paper examples.

OBJECT – ORIENTED PROGRAMMING EXERCISES
Direction:   Perform the following tasks:
1. a. Create a class named TestClass that holds a single private integer field and a public constructor. The only statement in the constructor is one that displays the message “Constructing”. Write a main()function that instantiates one object of the TestClass. Save the file as TestClass.cpp. Run the program and observe the results.
b. Write another main()function that instantiates an array of 10 TestClass objects. Save the file as TestClassArray.cpp. Run this program and observe the results.
2.   Create a class named Car. The Car class contains a static integer field named count. Create a constructor that adds 1 to the count and displays the count each time a Car is created. Create a destructor that subtracts 1 from the count and displays the count each time a Car goes out of scope. Write a main()function that declares an array of five Car objects. Output consists of five constructor messages and five destructor messages, each displaying the current count, similar to the output in Figure 8-34. Save the file as Car.cpp.







2. Create a class named Instructor. It contains a first and last name and an office
number, and its only constructor requires all three as arguments. Create a class named Classroom. It contains a building and a room number, and its only constructor requires both as arguments. Create a class named CollegeCourse. A CollegeCourse contains an Instructor, a Classroom, and a number of credits. Its constructor requires a first and last name of an instructor, the instructor’s office number, a Classroom building and room number, and a number of credits. Each of these classes contains a function that displays an object’s values. Write a main()function that instantiates at least two CollegeCourse objects and displays their values. Save the file as CollegeCourse.cpp.

Show More


Citations

MLA Citation

"Oop Programing". Anti Essays. 15 Dec. 2018

<http://parimatchstavki7.com/free-essays/Oop-Programing-599279.html>

APA Citation

Oop Programing. Anti Essays. Retrieved December 15, 2018, from the World Wide Web: http://parimatchstavki7.com/free-essays/Oop-Programing-599279.html