Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

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

More Books

Students also viewed these Databases questions