Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Course: Applied OO Programming Please, I need a help to write a program that uses data from acme_customers_updated.csv to create a list of customer objects

Course: Applied OO Programming

Please, I need a help to 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:

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

a. 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

2. 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:

1. Import the customer_address module

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

a. 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.

3. 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:

1. 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

a. 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.

b. The function will return the list of customers

2. 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

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

i. first name, last name, and full address

3. 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

1. Call the load_data() function

2. Store the list returned by the load_data function

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

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

5. Call display_phones() function

Include the following in your program

1. load_data() function

a. defined with the correct number of parameters

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

c. returns a list of customers

d. function is called

2. Program prompts for a state

3. display_customers() function

a. defined with the right number of parameters

b. finds and display customers from the target state

c. function is called

4. display_phones() function

a. defined with the correct number of parameters

b. finds all customers with phone numbers in area code 215

c. function is called

5. customer module is created with the Customer class defined

a. contains a constructor with the correct number of parameters

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

c. address instance variable is created and initialized correctly

d. contains get method or property for each instance variable

6. customer_address module is created with the CustomerAddress class defined

a. contains a constructor with the correct number of parameters

b. instance variables are created and initialized correctly

c. contains get method or property for each instance variable

Program Example

Customer data loaded successfully

Enter a State: PA

Minna Amigon 2371 Jerrold Ave Kulpsville PA 19443

Bette Nicka 6 S 33rd St Aston PA 19014

Blair Molet 209 Decker Dr Philadelphia PA 19132

Marjority Mastella 71 San Mateo Ave Wayne PA 19087

Amber Monarrez 14288 Foster Ave Jenkintown PA 19046

Deeanna Juhas 14302 Pennsylvania Ave Huntingdon PA 19006

Elly Morocco 7 W 32nd St Erie PA 16502

There are 7 in from the state of PA

215-874-1229

215-907-9111

215-934-8655

215-211-9589

215-255-1641

215-325-3042

215-964-3284

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_2

Step: 3

blur-text-image_3

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions