objective of the project: Implement a class address. An address has a house number street optional apartment number city state postal code. All member variables should be private and the member functions should be public. Implement two constructors: one with an apartment number one without an appartment number.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

objective of the project:

  1. Implement a class address.
  2. An address has a
    1. house number
    2. street
    3. optional apartment number
    4. city
    5. state
    6. postal code.
  3. All member variables should be private and the member functions should be public.
  4. Implement two constructors:
    • one with an apartment number
    • one without an appartment number.
  5. Implement a print function that prints the address with the street on one line and the city, state, and postal code on the next line.
  6. Implement a member function comesBefore that tests whether one address comes before another when the addresses are compared by postal code. Returns false if both zipcodes are equal.
  7. Use the provided main.cpp to start with.
    1. The code creates three instances of the Address class (three objects) to test your class.
    2. Each object will utilize a different constructor. You will need to add the class definition and implementation.
    3. The comesBefore function assumes one address comes before another based on zip code alone. The test will also return false when the zipcodes are equal.

---------------------------------

In the Main.cpp

  1. The code should create instances of the address class to test your class.
  2. Each object will utilize a different constructor. You will need to add the class definition and implementation.
  3. The comesBefore function assumes one address comes before another based on zip code alone. The test will also return false when the zipcodes are equal.

code provided:

#include <iostream> #include <iomanip> #include <string> using namespace std; #include "address.h" int main() { address defaultAddress; address myPlace(71, "North Broadway", 19, "North white plains", "NY", 10603); address yourPlace(86, "clover Rd", " North White Plains", "NY", 10603); cout << "Comparing address:\n"; myPlace.print(); cout << "\nWith address:\n"; yourPlace.print(); if (myPlace.comesBefore(yourPlace)) cout << "\nThe first address comes before the second\n"; else cout << "\nThe first address may come after the second\n"; myPlace.setZipcode(12603); if (myPlace.comesBefore(yourPlace)) cout << "\nThe first address comes before the second\n"; else cout << "\nThe first address may come after the second\n"; //The following makes sure proper OOP are followed, will not compile otherwise const address train(16, "Washington ave N", " North White Plains", "NY", 10601); train.print(); if (train.comesBefore(yourPlace)) cout << "\nThe first address comes before the second\n"; else cout << "\nThe first address may come after the second\n"; return 0; }

----------------------------

OUTPUT SHOULD LOOK LIKE THIS:

Comparing address:

71 North Broadway, #19

NORTH WHITE PLAINS, NY 10603

With address:

86 Clover Rd

North White Plains, NY 10603

The first address comes before the second

The first address may come after the second

16 Washington ave N

White Plains, NY 10601

\The first address comes before the second

----------------

Main goal is for to create a :

  1. Class header: address.h
  2. Class Implementation: address.cpp
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education