Question
C++ Code Directions: Write a program that uses an array of nested structs to store the addresses for your stores customers. Each customer has a
C++ Code
Directions:
Write a program that uses an array of nested structs to store the addresses for your stores customers.
Each customer has a name and two addresses: home address and business address. Each address has a street, city, state, and zip code.
1. Data structure a. Define an Address struct with street, city, state and zip fields b. Define a Customer struct with lastNm and firstNm fields, plus homeAddr and busAddr fields of type Address c. Declare an array of type Customer
2. Use a menudriven program with the following selections: a. Enter new customer b. Display all customers c. Display a particular customer d. Exit the program
3. Define the following 5 functions a. int displayMenu(); Outputs the menu selections Inputs the users selection Validates that the user has entered a valid selection b. Customer getCustomer(); Asks the user to input the customers first name, last name and the two addresses and stores in a single Customer struct c. void showCustomer(Customer); Outputs the information for a single Customer struct d. Address getAddress(); Asks the user to enter each component of the address (street, city, state and zip) and stores in a single address struct Note that street will contain embedded blanks, so you will need to use getline. Since you are mixing cin and getline, you will need to use cin.ignore to skip over the last endline character in the input prior to using getline. e. void findCust(Customer[], int); Asks the user to enter a customers first and last names Searches the array of Customers for a match If there is a match, prints out all information for the particular customer If not match, prints an error message.
SAMPLE OUTPUT
CAUsersNancy thibeault Documents Visual Studio 2012 Projects Topic StructDebugiTopi. Customer Contacts Menu Select from the menu belov 1: Enter new customer 2: Display all customers 31 Display a particular cutoner 4: Exit program Enter customer first name: Nancy Enter customer last name: Jones Enter Business Address Enter street addressi 444 V 3rd St. Enter city. Dayton Enter state: OH Enter zip codes 45482 Enter Hone Address Enter street address: 1888 Meadow Dr. Enter city: Beavercreek Enter state: OH Enter cedet 45431 Customer Contacts Menu Select from the menu below 1: Enter new customer 2: Display all customers 3: Display a particular cutorer 41 Exit program Enter customer first name Bill Enter customer last name: Snith Enter Business Address Enter street addres 208 Pentaqo Blud. Enter city: Heavercreek Enter catel OH Enter zip code: 45432 Enter Hone Address Enter street address1 1778 Forest Dr. Enter city: Beavercreek Enterstatel OH Enter aip code: 45432 Customer Contacts Menu Select from the menu belou 1. Enter new customer 21 Display all 31 Display a particular cutomer 41 Exit program customer nanet Nancy Jones Business address! 444 V 3rd St, Dayton, OH 45482 Home address: 100 Meadow Dr. Beavercreek. OH 45431 customer Rare Bill Saith business address: 280 Pentage Blvd. Beavercreek. OH 45432 Home address 1773 Porest Dr. Beavercreek, OH 45432Step 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