Question: Write a program that uses data from acme_customers_updated.csv to create a list of customer objects and display details about the customers. The program will consist

Write a program that uses data from acme_customers_updated.csv to create a list of customer objects and display details about the customers. The program will consist of three Python modules: address.py, customer.py, and customer_client.py

customer_address.py

This file/module will contain the class definition for the CustomerAddress class. The class definition will include the following:

A constructor: Parameters for the constructor include the street address, city, state, and zip code

Used the parameters to initialize instance variables for the street address, city, state, and zip code

Note: I will leave it up to students to name the instance variables appropriately. Use descriptive names

Include get property (or get method) for each of the instance variables

customer.py

This file/module will contain the class definition for the Customer class. Within this class include the following:

Import the customer_address module

A constructor: Parameters for the constructor include first name, last name, street address, city, state, zip code, and phone

Use the parameters passed in to initialize instance variables for the first name, last name, phone, and address

Note: I will leave it up to students to name these instance variables appropriately. Use descriptive names

Note: The value of the address instance variable will be an object of the CustomerAddress class. The street address, city, state, and zip will be used to create an object of CustomerAddress.

Include get property (or get method) for each instance variable. DO NOT include set properties

customer_client.py

This file/module will contain the code that interacts with the user. This module will contain the main program logic.

The following function will be required:

load_data() function. This function takes no parameters. The function will open the acme_customers_updated.csv and use the information from the file to create a list of customer objects and return the list. Data from each line of the file will be used to create a customer. Once a customer object is created, it will be added to the list of customers.

Required logic

Each line in the file will be split into individual fields to create a customer object. The following fields are required for a customer object: first name, last name, street address, city, state, zip code, phone1.

The function will return the list of customers

display_customerss() function. This function takes two parameters: the list of customers created by the load_data() function, and a variable containing the two-letter code for a state. The program will display all customers (first name, last name, and full address) from the target state

Required logic

Loop through the list of customers and determine which customers live in the target state and display those customers

first name, last name, and full address

display_phones(): This function takes the list of customers as parameter and displays all phone numbers with area code 215 and a count of customers with area code 215

Program General flow

Call the load_data() function

Store the list returned by the load_data function

Prompt the user to enter a state (e.g. PA)

Pass the state and the list of customers to the display_customers() function

Call display_phones() function

Include the following in your program

load_data() function 5pts

defined with the correct number of parameters

contains code that reads the file and loads customer objects into a list

returns a list of customers

function is called

Program prompts for a state 1pt

display_customers() function 3pts

defined with the right number of parameters

finds and display customers from the target state

function is called

display_phones() function 3pts

defined with the correct number of parameters

finds all customers with phone numbers in area code 215

function is called

customer module is created with the Customer class defined 8pts

contains a constructor with the correct number of parameters

instance variables (first name, last name, phone number) are created and initialized correctly

address instance variable is created and initialized correctly

contains get method or property for each instance variable

customer_address module is created with the CustomerAddress class defined 5pts

contains a constructor with the correct number of parameters

instance variables are created and initialized correctly

contains get method or property for each instance variable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!