Question
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.
- create an address without the apartment number.
- create another address with the apartment number.
- 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
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started