Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The class definition for a House class, contains the following private data members: the address (character array of 30 elements), city (character array of 20

image text in transcribed
The class definition for a House class, contains the following private data members: the address (character array of 30 elements), city (character array of 20 elements), state (character array of 10 elements) and price (as a double). It also has the following public member methods: . set_all0: This method is passed an address, city, state and price and assigns these arguments to the private data members of the class. . get_ addressO: This method returns the address . get_city0: This method returns the city . get_state0: This method returns the state .get_price0: This method returns the price. get_state: This method returns the state. .printO: This method prints the values of the private data members. Write the class definition for the House in the file house.h. The set all method should use the default function arguments so that all data members will be initialized regardless of whether you supply values to the method. Initializing the address, city, state to NULL), and the price to 0.0 Write the methods definitions for the house class in the file house.epp Write the C++ program using the house class to manage information about several houses that you are interested in purchasing. Create 5 house objects: house1, house2, house3, house4, and house5. For housel, use the set all method using the default arguments. For house2, the address is "123 Main St.", the rest is the default. For house 3, the address is "111 First St.", and the city is "Naperville", the rest is the default. For House4, you are given the address "222 Second St.", the city "Lisle", and the state "IL", the rest the default. For house5, all the values are given as follows: 333 Third St.", "Geneva", "IL", and 185000.00. Create an object, house6, to be the copy of house4. (Hint: Use the copy constructor. You should define it in the house.h file, and write the code for it in the method file, a. b. d. i.e., the house.cpp file.) Invoke the print method for each house object. Test if the two houses house6 and house4 are the same. If they are equal, you should print the message "House6 and House4 are the same", otherwise, print "House6 and House4 are different, e. f. (Hint: You should overload the = = operator. Again, define it in the .h file, and write the code for it in the method file, the house.cpp file)

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions