Question

Python 3 IDE/AWS Problem You are tasked with writing a new program for your company that...

Python 3 IDE/AWS

Problem

You are tasked with writing a new program for your company that keeps track of the customer’s information and his or her current bill. The company wants the name, address, phone number, and balance to be stored for each customer.

This program will demonstrate the following:

  • How to use a class to organize data
  • How to use methods to access the data of a class
  • How to create objects from a class

Solving the Problem

Step 1

The first step in designing a class to organize data is to determine what data you want to store in the class and what methods you want to use to modify the data. You have been given the required data items, but what methods do you want to include? It is common to create accessor methods for each data item in the class.

Step 2

The next step is to create the accessor methods of the class. These methods can be used to simply set the values of the data items or even mold how the data look. In the phone number’s accessor method, a specific layout of the number is required to be set, and the balance accessor does not allow a negative balance to be entered.

Step 3

The next step is to create a list of customers in the program. A loop is used to add 5 customers. If bad input is entered into the phone or balance, then the program will continue to ask for those data.

Step 4

You can now write code to find the customer information for all of the customers or individual customers in the list.

Documentation Guidelines:

Use good programming style (e.g., indentation for readability) and document each of your program parts with the following items (the items shown between the '<' and '>' angle brackets are only placeholders. You should replace the placeholders and the comments between them with your specific information). Your cover sheet should have some of the same information, but what follows should be at the top of each program's sheet of source code. Some lines of code should have an explanation of what is to be accomplished, this will allow someone supporting your code years later to comprehend your purpose. Be brief and to the point. Start your design by writing comment lines of pseudocode. Once that is complete, begin adding executable lines. Finally run and test your program.

Deliverable(s):

Your deliverable should be a Word document with screenshots showing the source code and running results, and discuss the issues that you had for this project related to AWS and/or Python IDE and how you solved them for all of the programs listed above as well as the inputs and outputs from running them. Submit a cover sheet with the hardcopy of your work.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#python code

"""
a new program for your company that keeps track of
the customer’s information and his or her current bill.
 The company wants the name, address, phone number,
 and balance to be stored for each customer.
"""


class Customer:
    def __init__(self, name="None", address = "None",phoneNumber = "None", balance =0.0):
        self.__name = name
        self.__address = address
        self.__phoneNumber = phoneNumber
        self.__balance = balance
    #mutator and accessor


    def getName(self):
        return self.__name
    def getAddress(self):
        return self.__address
    def getPhoneNumber(self):
        return self.__phoneNumber
    def getBalance(self):
        return self.__balance


    def setName(self, name):
        self.__name = name
    def setAddress(self, address):
        self.__address = address
    def setPhpneNumber(self, phoneNumber):
        self.__phoneNumber = phoneNumber

    def setBalance(self, balance):

        self.__balance = balance

    def __str__(self):
        return "Customer Name: "+self.__name+"\nAddress: "\
                +self.__address+"\nPhone Number: "+self.__phoneNumber+"\nBalance: "+str(self.__balance)


if __name__ =="__main__":
    # Method to check whether a given phone number in
    # valid format or not
    def isvalidNumber(phone_number):
        if len(phone_number) < 10 or len(phone_number) > 10:
            return False
        if not phone_number.isdigit():
            return False
        return True
    """
    The next step is to create a list of customers in the program.
     A loop is used to add 5 customers. If bad input is entered into 
     the phone or balance, then the program will continue to ask for those data.
    """
    customers =[]
    for i in range(0, 6):
        name = input ("Enter customer name: ")
        address = input("Enter customer's address: ")
        phone  = input("Enter phone number: ")
        while( not isvalidNumber(phone)):
            print("ERROR!!!... wrong format of phone number...")
            phone  = input("Enter phone number: ")
        balance = float(input("Enter balance: "))
        while(balance < 0):
            print("ERROR!!! ... balance can not be negative...")
            balance = float(input("Enter balance: "))
        # add customer to list
        customers.append(Customer(name, address, phone, balance))
    # code to find customer
    custmerName = input("Enter customer name to be searched: ")
    found = False
    for i in customers:
        if i.getName() == custmerName:
            print(i)
            found = True
    if(not found):
        print("Customer details not found...")

#Screenshots for indentation help

#output

//if you need any help regarding this solution .......... please leave a comment ........ thanks

Add a comment
Know the answer?
Add Answer to:
Python 3 IDE/AWS Problem You are tasked with writing a new program for your company that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python 3 coding with AWS/Ide. Objective: The purpose of this lab is for you to become familiar with Python’s built-in te...

    Python 3 coding with AWS/Ide. Objective: The purpose of this lab is for you to become familiar with Python’s built-in text container -- class str-- and lists containing multiple strings. One of the advantages of the str class is that, to the programmer, strings in your code may be treated in a manner that is similar to how numbers are treated. Just like ints, floats, a string object (i.e., variable) may be initialized with a literal value or the contents...

  • Create the Python code for a program adhering to the following specifications. Write an Employee class...

    Create the Python code for a program adhering to the following specifications. Write an Employee class that keeps data attributes for the following pieces of information: - Employee Name (a string) - Employee Number (a string) Make sure to create all the accessor, mutator, and __str__ methods for the object. Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: - Shift number (an integer,...

  • Questions Submission Question 2: Stacks Problem Write a program that keeps track of where cars are...

    Questions Submission Question 2: Stacks Problem Write a program that keeps track of where cars are located in a parking garage to estimate the time to retrieve a car when the garage is full. This program will demonstrate the following: How to create a list for use as a stack, How to enter and change data in a stack. Solving the Problem Step 1 In Python, the stack data structure is actually implemented using the list data structure with a...

  • Problem You work for a dealership that deals in all kinds of vehicles. Cars, Trucks, Boats,...

    Problem You work for a dealership that deals in all kinds of vehicles. Cars, Trucks, Boats, and so forth need to be inventoried in the system. The inventory must be detailed so that it could be searched based on number of doors, engine type, color, and so on. This program will demonstrate the following: How to create a base class How to extend a based class to create new classes How to use derived classes Solving the Problem Step 1...

  • In this class, you will need to install the Amazon WorkSpace (AWS), a cloud based virtual...

    In this class, you will need to install the Amazon WorkSpace (AWS), a cloud based virtual desktop, and use the SQL Server in the AWS to complete the database projects of the class. An email with AWS access code has been sent to your CTU email account. Double check the Junk Folder if you cannot see it. Click here for the instruction to install and launch AWS. After installing the AWS application, launch it and login to your AWS virtual...

  • in java : Create Java Application you are to create a project using our designated IDE...

    in java : Create Java Application you are to create a project using our designated IDE (which you must download to your laptop). Create the code to fulfill the requirements below. Demonstrate as stipulated below. Create a Main Application Class called AddressBookApplication (a counsole application / command line application). It should Contain a Class called Menu that contains the following methods which print out to standard output a corresponding prompt asking for related information which will be used to update...

  • For all problems you must: Write a Python (.py) program Test, debug, and execute the Python...

    For all problems you must: Write a Python (.py) program Test, debug, and execute the Python program Submit a copy of your commented source code on-line (11 pts.) Create a Person class that contains the following members: name, email, and phone_number Provide a constuctor that initializes all three members with data passed to the constructor. Add a __str__ method that returns a string printing the data members. Provide methods that allows you to get and set all three data members....

  • PLEASE YOU PYTHON 3 TO SOLVE! THANKS! PLEASE YOU PYTHON 3 TO SOLVE! THANKS! Example 1...

    PLEASE YOU PYTHON 3 TO SOLVE! THANKS! PLEASE YOU PYTHON 3 TO SOLVE! THANKS! Example 1 Design a class named Information that holds the following personal data: .name, age, address (this attribute has a default value of “unknown"), and phone number. . All the attributes are defined as private. • Write appropriate accessor and mutator methods. • Complete the definition of the str_ method, such that it displays each Information object's data in the following format: name: "Sarah Jones” –...

  • For each problem, you must: Write a Python program Test, debug, and execute the Python program...

    For each problem, you must: Write a Python program Test, debug, and execute the Python program Save your program in a .py file and submit your commented code to your Student Page. Note regarding comments: For every class, method or function you create, you must provide a brief description of the what the code does as well as the specific details of the interface (input and output) of the function or method. (25 pts.) Write a program that reads in...

  • Write a program in java. You are tasked with writing an application that will keep track...

    Write a program in java. You are tasked with writing an application that will keep track of Insurance Policies. Create a Policy class called InsurancePolicies.java that will model an insurance policy for a single person. Use the following guidelines to create the Policy class: • An insurance policy has the following attributes: o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT