Question

In: Computer Science

In Python Create customer information system as follows: Ask the user to enter name, phonenumber, email....

In Python Create customer information system as follows:

Ask the user to enter name, phonenumber, email. Create a file by his name and save it in the hard disk. Do this repeatedly until all the users are entered. (for example, if the user enters 10 customers’s information, there should be 10 different files created.)

Now build the customer value for a retail company as follows:

Ask the customer to enter his name. If you have his information already stored, then showing him his stored number and email. If not, ask his phone and email and save on his name.

Ask him to enter what he buying (itemname, quantity, unit price.) repeatedly until he enters all the items. Calculate the total including the tax (0.0825). Append the total price to his file.

Solutions

Expert Solution

Save below code in file ending with .py extension

import os


def create_file():
    """
    function to create file with user name
    if existing file with name it will replace
    :return:
    """
    while 1:
        name = input("Enter name: ")
        phone_number = input("Enter phone number: ")
        email = input("Enter email: ")
        with open(name, 'w') as f:
            f.write("Name: %s\n" % name)
            f.write("Phone: %s\n" % phone_number)
            f.write("Email: %s\n" % email)
        another_entry = input("do you want to add another entry[y/n]: ").lower()
        if another_entry not in ('y', 'yes'):
            break


def build_info():
    """
    function to build info
    :return:
    """
    # getting all files
    files = os.listdir()
    name = input("Enter name: ")
    # if name file not found
    if name not in files:
        # creating new one
        print("%s not found" % name)
        phone_number = input("Enter phone number: ")
        email = input("Enter email: ")
        with open(name, 'w') as f:
            f.write("Name: %s\n" % name)
            f.write("Phone: %s\n" % phone_number)
            f.write("Email: %s\n" % email)
    with open(name) as f:
        for line in f.readlines():
            print(line.strip())
    # asking item details and adding
    with open(name, 'a') as f:
        print("\n{:<20s}{:<20s}{:<20}{:<20}".format("Item", "Quantity", "Per Unit", "Price"), file=f)
        total = 0
        tax = 0.0825
        while 1:
            item_name = input("Item name: ")
            quantity = int(input("Enter the quantity: "))
            per_unit_price = float(input("Enter per unit price: "))
            price = quantity * per_unit_price
            total += price
            print("{:<20s}{:<20s}{:<20}{:<20}".format(item_name, str(quantity), str(per_unit_price), str(price)),
                  file=f)
            another_entry = input("do you want to add another item[y/n]: ").lower()
            if another_entry not in ('y', 'yes'):
                break
        total += tax
        print("-" * 70, file=f)
        print(" " * 55 + " Total %.2f" % total, file=f)


# calling both functions
create_file()
build_info()

# OUT

# File

Please do let me know if u have any concern...


Related Solutions

In Python Create customer information system as follows: Python 3 Create customer information system as follows:...
In Python Create customer information system as follows: Python 3 Create customer information system as follows: Ask the user to enter name, phonenumber, email for each customer. Build a dictionary of dictionaries to hold 10 customers with each customer having a unique customer id. (random number generated) Take the keys of the above mentioned dictionary which are customer ids and make a list. Ask the use to enter a customer id and do a binary search to find if the...
##### answer in python #####picture of output and input Create customer information system as follows: Ask...
##### answer in python #####picture of output and input Create customer information system as follows: Ask the user to enter name, phonenumber, email for each customer. Build a dictionary of dictionaries to hold 10 customers with each customer having a unique customer id. (random number generated) Take the keys of the above mentioned dictionary which are customer ids and make a list. Ask the use to enter a customer id and do a binary search to find if the customer...
First, the Python program prompts user to enter user information (name, email, and phone number). Then...
First, the Python program prompts user to enter user information (name, email, and phone number). Then it displays a menu called “Fish Information” that has the following fish type: 1. Cat Fish 2. Red Fish 3. Any other fish Let user choose the fish type that he/she got and input the length of the fish. Then the program will determine what should be done with this particular fish. Based on the following criteria: Criteria: Length: FISHTYPE - Cat Fish <10:...
USE PYTHON. Create a program that will ask a user to enter whole positive numbers. The...
USE PYTHON. Create a program that will ask a user to enter whole positive numbers. The program will use a while loop to let the program keep running. The user will be allowed to use the program as long as the quitVariable is equal to 'y' or 'Y'. When the user decides to quit playing, say "Thanks for playing!". The program will use a for loop to test if the number are even or odd. If even print "number is...
PYTHON Ask the user to enter the number of students in the class. Thereafter ask the...
PYTHON Ask the user to enter the number of students in the class. Thereafter ask the user to enter the student names and scores as shown. Output the name and score of the student with the 2nd lowest score. NOTE: You may assume all students have distinct scores between 0 and 100 inclusive and there are at least 2 students NOTE: You may only use what has been taught in class so far for this assignment. You are not allowed...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will first enter a password, then enters the same password again; If the second input is the same as first one, the user successfully creates the password. Print “Well done.”; Otherwise, the user will be directed to repeat the whole process (go to step 1.)
In python Write the code to ask a user to enter a number in the range...
In python Write the code to ask a user to enter a number in the range of 1-100. Have the code checked to make sure that it is in this range. If it is not, let the user re-enter the number. The user should be able to re-enter numbers until the number is within the correct range.
Your Application should ask the user to enter their name and their salary.
Create a C# Console Application, name the solution Homework 6 and the project TaxRate.Your Application should ask the user to enter their name and their salary. Your application should calculate how much they have to pay in taxes each year and output each amount as well as their net salary (the amount they bring home after taxes are paid!). The only taxes that we will consider for this Application are Federal and FICA. Your Application needs to validate all numeric...
Using the given file, ask the user for a name, phone number, and email. Display the...
Using the given file, ask the user for a name, phone number, and email. Display the required information. These are the Files that I made: import java.util.Scanner; public class Demo5 { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.println("New number creation tool"); System.out.println("Enter name"); String name = keyboard.nextLine(); System.out.println("Enter phone number"); String phoneNumber = keyboard.nextLine(); System.out.println("Enter email"); String email = keyboard.nextLine(); Phone test1 = new SmartPhone(name, phoneNumber, email); System.out.print(test1); System.out.println("Telephone neighbor: " + ((SmartPhone) test1).getTeleponeNeighbor()); }...
In your python program, ask the user to enter the annual income of an employee and...
In your python program, ask the user to enter the annual income of an employee and the years of experience. Pass these data to a function. The function decides if an employee does qualify for a loan or does not, then it prints a message based on the following rules: If the income is equal or greater than $40000, the function checks if the employee’s years of experience is greater than 4, if so the employee gets $6000 loan; otherwise,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT