Question

In: Computer Science

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

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

  1. 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 exist in the list.
  2. Sort the above mentioned list by insertion sort. (Write insertion sort code)

Solutions

Expert Solution

import random

#insertion sort
def insSort(a): 
    for i in range(1, len(a)): 
        k = a[i] 
        j = i-1
        while(j >=0 and k < a[j]): 
                a[j+1] = a[j] 
                j -= 1
        a[j+1] = k 
  
#binary search
def binary_search_alg(slist,sid):
        f = 0
        l= len(slist)-1
        ans = False
        while(f<=l and not ans):
                mid = (f + l)//2
                if(slist[mid]==sid):
                        ans=True
                else:
                        if(sid< slist[mid]):
                                l=mid-1
                        else:
                                f=mid+1 
        return ans

dic={}
i=0
cid=[]

while(i<10):
    name=(input("Enter name:"))
    phone=(int(input("Enter phonenumber:")))
    email=(input("Enter email:"))
    #here we are considering random values among 2digit numbers
    r=random.randint(10,100)
    if r not in cid: 
        dic.update({r:{'email':email,'phonenumber':phone,'name':name}})
        cid.append(r)
    i=i+1
print("\n")
print("Customer id's are:")
print(cid)
print("\n")
searchid=int(input("Enter customer id to search:"))

insSort(cid)
print("Sorted customer id's are:")
print(cid)

val=binary_search_alg(cid,searchid)
if(val==True):
    print("Customer id exist in the list")
else:
    print("Customer id doesn't exist in the list")
print("\n\n")
print("For verifying\n")
print("Dictionary values are:")    
print(dic)
print("\n")

Note: As no limit is given for random numbers, i'm cosidering random numbers between 10 and 100. This can be changed by modifying "random.randint(10,100)" in the code.


Related Solutions

##### 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...
In PYTHON 3 using functions. Per the client, you have the following information:  customer name, burger choice,...
In PYTHON 3 using functions. Per the client, you have the following information:  customer name, burger choice, time of purchase, and total bill. By the end of the day, your program will provide the following information: 1. Top three best clients with the highest spending 2. Name of client with second to last lowest bill 3. busiest hour of the day based on number of clients Assumptions 1. Your program will not handle more than 100 clients per day 2. The...
Question 1: Using Python 3 Create an algorithm The goal is to create an algorithm that...
Question 1: Using Python 3 Create an algorithm The goal is to create an algorithm that can sort a singly-linked-list with Merge-sort. The program should read integers from file (hw-extra.txt) and create an unsorted singly-linked list. Then, the list should be sorted using merge sort algorithm. The merge-sort function should take the head of a linked list, and the size of the linked list as parameters. hw-extra.txt provided: 37 32 96 2 25 71 432 132 76 243 6 32...
Create a program/function using PYTHON that takes cents and returns to the customer how MANY coins...
Create a program/function using PYTHON that takes cents and returns to the customer how MANY coins it takes to make the change... Ex. if the change owed is 50 cents then return a 2 (for two quarters) if the change owed is 10 cents then return a 1 (for one dime) AGAIN please write this in java and please provide EXPLANATION of answer
Create a Python 3 program that acts as a grocery store shopping cart. 1. Create a...
Create a Python 3 program that acts as a grocery store shopping cart. 1. Create a class named GroceryItem. This class should contain: - an __init__ method that initializes the item’s name and price - a get_name method that returns the item’s name - a get_price method that returns the item’s price - a __str__ method that returns a string representation of that GroceryItem - an unimplemented method is_perishable Save this class in GroceryItem.py. 2. Create a subclass Perishable that...
Python 3 Script: A company has classified its employees as follows.
Python 3 Script: A company has classified its employees as follows.Managers Hourly workersCommission workers Pieceworkers- who receive a fixed weekly salary- who receive a fixed hourly wage for up to the first 40 hours they work and“time-and-a-half”, i.e. 1.5 times their hourly wage, for overtime hours worked), - who receive $250 plus 5.7% of their gross weekly sales)- who receive a fixed amount of money per item for each of the items theyProduce. Each pieceworker in this company works on...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times,...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times, each time using a different syntax to define the list. Write a while loop that prints the numbers from 1 to 10. Convert your previous loop into a for loop. Rewrite your for loop to only have one number in the range. Write a for loop to print out each item of your list of 10 numbers, all on the same line, separated by...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times,...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times, each time using a different syntax to define the list. Write a while loop that prints the numbers from 1 to 10. Convert your previous loop into a for loop. Rewrite your for loop to only have one number in the range. Write a for loop to print out each item of your list of 10 numbers, all on the same line, separated by...
3. Identify the following as master data or transaction data Create New Customer Create Contact Person...
3. Identify the following as master data or transaction data Create New Customer Create Contact Person for Customer Create BP relationship Create Customer Inquiry Create Customer Quotation Create Sales Order Referencing a Quotation Check Stock Status Display Sales Order Start Delivery Process Check Stock Status Pick Materials on Delivery Note Post Goods Issue Check Stock Status Create Invoice for Customer Display Billing Document and Customer Invoice Post Receipt of Customer Payment Review Document Flow
ou will create a GUI data entry program to be used to enter Customer Information. This...
ou will create a GUI data entry program to be used to enter Customer Information. This program should be based on the requirements and design you created in previous modules. It will be a GUI, based either on the Java Swing classes or JavaFX. The program will allow for entry of all fields described in your requirements and include appropriate validations for each field. It will be left to you to decide if the validations methods should be part of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT