Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a class Address. An address has a house number, a street, an optional apartment number, a city, a state, and a postal code. Supply

Implement a class Address. An address has a house number, a street, an optional apartment number, a city, a state, and a postal code. Supply two constructors: one address with an apartment number and one address without the apartment number. Supply a print function that prints the address with the house number, street name, optional apartment number on one line and the city, state, and postal code on the next line. Overload an operator less than that tests whether one address comes before another when the two addresses are compared by postal code.

house_number is an integer; street is a string; apartment_number is an integer; city is a string; state is a string; postal_code is a string; 

Please create the following files i need 3 FILES Address.h Address.cpp main.cpp Use Address as your class name Use main.cpp as your test program and write the following tests.

  1. create an address without the apartment number.
  2. create another address with the apartment number.
  3. Use the print function to print out the addresses that you just create in your main.cpp. Use the information in below to create your addresses:
Comparing address 148 First Ave San Diego, CA, 10392 with address 553 Second St, #44 San Diego, CA, 10394 The first address comes before the second 
  1. Use a less than operator to compare two address. If the first address' zip code is less than the second address' zip code, then print The first address comes before the second otherwise, print The first address comes after the second

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions