Question

) Al Shams supermarket is a largest shopping center in Oman for electronic items and home appliance. They want to create invo
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:-

#globally defining the lists
purchase_amount=[]
customer_type=[]
discount=[]
total_amount=[]
sales_tax=[]
net_purchase_amount=[]

# funtion calculates discount of each customer and stores list
def calculate_discount():
   
    #global keyword is used to make the list golbal and can access anywhere inthe code
    global discount
   
    #loop checks the customer type and finds their discount
    for i in range(10):      
        if(customer_type[i]=="O"):
            if(purchase_amount[i]<100):
                discount.append( purchase_amount[i]*0.05)
               
            elif(purchase_amount[i]>=100 and purchase_amount[i]<200):
                discount.append(purchase_amount[i]*0.01)
            else:
                discount.append(purchase_amount[i]*0.15)
               
        else:
            if(purchase_amount[i]<100):
                discount.append(purchase_amount[i]*0.05)
               
            else:
                discount.append(purchase_amount[i]*0.10)
   
    print("\nDiscount amount of each customer:")
    print(discount)
   
   
#function to calculate sales tax   
def calculate_sales_tax():
    global sales_tax
   
    #loop finds the sales tax of each customer and stores in the list
    for i in range(10):
        if(total_amount[i]<150):
            sales_tax.append(round(total_amount[i]*0.01,2))
        elif(total_amount[i]>=150 and total_amount[i]<400):
            sales_tax.append(round(total_amount[i]*0.02,2))
        else:
            sales_tax.append(round(total_amount[i]*0.03,2))
           
           
    print("\nSales tax of each customer: ")
    print(sales_tax)           
   

#funtion calculate total amount =purchase_amount-discount for each customer and stores in the list  
def calculate_total_amount():
    global total_amount
    for i in range(10):
        total_amount.append(purchase_amount[i]-discount[i])
       
    print("\nTotal Amount of each customer: ")
    print(total_amount)
   

# function calculates the net_purchase_amount= total_amount+sales_tax for each customer and stores in list  
def calculate_net_purchase_amount():
    global net_purchase_amount
    for i in range(10):
        net_purchase_amount.append(total_amount[i]+sales_tax[i])
       
    print("\nNet Purchase amount of each customer: ")
    print(net_purchase_amount)
   
   
#function calculates the sum of discount and th net_purchase_amount of each customer
def display_sum():
    print("\nSum of discount and net_purchase_amount:")
    sum_dis_net=0
    for i in range(10):
        sum_dis_net=sum_dis_net+discount[i]+net_purchase_amount[i]
   
    print(sum_dis_net)
   
   
#function calculates the average of net_purchase_amount who bought online.  
def display_average():
    print("\nAverage net_purchase_amount of online customers: ")      
    su=0 #set su to 0 to store sum
    count=0 #set count to 0 store count of online purchasers
    for i in range(10):
        if(customer_type[i]=="O"):
            su+=net_purchase_amount[i]
            count+=1
           
           
    print(round(su/count,2)) # prints the average
   
#function finds and prints the maximum of the net_purchase_amount
def max_net():
    print("\nMaximum of the net_purchase_amount: ")
    maximum=net_purchase_amount[0] # let first amount be maximum
    for i in range(1,10):
        if(net_purchase_amount[i]>maximum):
            maximum=net_purchase_amount[i]
       
    print(maximum)
   
   
#function finds the count of the customers who bought online and net_purchase amount is > 200
def display_online():
    print("\nNumber of online customers whose net_purchase_amount is > 200: ")
    count=0
    for i in range(10):
        if(customer_type[i]=="O" and net_purchase_amount[i]>200):
            count+=1
           
    print(count)
           
           
       
   

#main function
def main():   
    global purchase_amount
    global customer_type
   
    #take user input of the purchase_amount and customer_type
    print("Enter the purchase amount of 10 customers:")
    purchase_amount=list(map(int,input().split()))
    print("Enter customer type:")
    customer_type=list(map(str,input().split()))  
   
    # calling all the functions
    calculate_discount()
    calculate_total_amount()
    calculate_sales_tax()
    calculate_net_purchase_amount()
    display_sum()
    display_average()
    display_online()
    max_net()              
   
   
# calling main function
main()

#globally defining the lists purchase_amount=[] customer type=[] discount=[] total amount=[] sales tax=[] net_purchase_amount#function to calculate sales tax def calculate_sales_tax(): global sales tax #loop finds the sales tax of each customer and s# function calculates the net_purchase_amount= total amount+sales tax for each customer and stores in list def calculate_net_
#function finds and prints the maximum of the net_purchase_amount def max_net(): print(\nMaximum of the net_purchase_amount:#main function def main(): global purchase_amount global customer type #take user input of the purchase_amount and customer_t

Sample Output:-Enter the purchase amount of 10 customers: 100 75 110 300 150 400 200 100 140 100 Enter customer type: OO FOO FOO FOO Discoun

Add a comment
Know the answer?
Add Answer to:
) Al Shams supermarket is a largest shopping center in Oman for electronic items and home...
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
  • Computer science help! A software company sells their software packages for $99.00 each. They would like...

    Computer science help! A software company sells their software packages for $99.00 each. They would like you to write a program that will calculate and display an invoice for their customers. Quantity discounts are given according to the following table: Quantity   Discount 1 - 9 No discount 10 – 19 20% 20 – 49 30% 50 - 99 40% 100 or more 50% Write a C++ program that asks for the customer’s name and the number of software packages sold...

  • Assume that an imaginary supermarket sells items that are identified by a unique item number which...

    Assume that an imaginary supermarket sells items that are identified by a unique item number which is an integer in range 100 to 499 inclusive. The items are classified in four different categories based on their numbers, and each category defines a different sales tax rate. These four categories along with the range of item numbers included in them, and their specific sales tax rates has been summarized in the following table:    Category Item Numbers Sales Tax Rate A                100...

  • amming Projects 1. Keith's Sheet Music needs a program to implement its music teacher's dis- count...

    amming Projects 1. Keith's Sheet Music needs a program to implement its music teacher's dis- count policy. The program is to prompt the user to enter the purchase total and to indicate whether the purchaser is a teacher. The store plans to give each customer a printed receipt, so your program is to create a nicely format- ted file called receipt.txt. Music teachers receive a 10% discount on their sheet music purchases unless the purchase total is $100 or higher....

  • In a mall, three neighboring stores offer discount coupons. Store A has 300 envelopes, Store B...

    In a mall, three neighboring stores offer discount coupons. Store A has 300 envelopes, Store B has 600 envelopes, and Store C has 900 envelopes. Each envelope contains one, two, or three coupons. The following table shows the number of envelopes according to the number of coupons in them in each store. Store\#Coupons 1 2 3 Total A 200 100 0 300 B 300 200 100 600 C 400 300 200 900 Each customer selects an envelope from each store...

  • Write a C++ program that will calculate the total amount of money for book sales at...

    Write a C++ program that will calculate the total amount of money for book sales at an online store. For each sale, your program should ask the number of books sold and then the price for each book and the shipping method (‘S’ for standard shipping and ‘E’ for expedited shipping). The program will produce a bill showing the subtotal, the sales tax, the discount, the shipping charge, and the final total for the sale. The program will continue processing...

  • M. Lowenthal You are to use Linked Lists to do this program The "XYZ Widget Store...

    M. Lowenthal You are to use Linked Lists to do this program The "XYZ Widget Store receivee shipments of widgots at varlous oosts. The store's polcy isto charge a 30% markup, and to sol widgets which were received earlier before widgets whic were received lator. This is called a First In First Out policy (FIFO) a program using lnked lists that reeds in 3 types of input data and does the following widgets sold he receipt of a quantity of...

  • Parts E F AND G please Question 7 Simpson Ltd. (Simpson) imports novelty items from Asian...

    Parts E F AND G please Question 7 Simpson Ltd. (Simpson) imports novelty items from Asian manufacturers and sells them to retailers. The company began operations at the beginning of 2018. The following information is available about Simpson's operation: • Simpson's suppliers allow it 30 days to pay for purchases. Assume purchases are made evenly throughout the year. Simpson allows customers 60 days to pay for their purchases. Assume sales occur evenly throughout the year. • Simpson has a markup...

  • A buyer places an order for the following items. The merchandise cost is list price less...

    A buyer places an order for the following items. The merchandise cost is list price less a trade discount of 30% and 15%. Calculate the cost to be paid for the entire purchase order. units list Item purchas ed cost sweaters $35.00 skirts $25.00 jackets 36 $75.00 72 48 An invoice for men's wallets is dated February 7 with terms of 8/10, net 30. The total billed cost of the merchandise is $12,000.00 How much should be paid if the...

  • Question 7 Simpson Ltd. (Simpson) imports novelty items from Asian manufacturers and sells them to retailers....

    Question 7 Simpson Ltd. (Simpson) imports novelty items from Asian manufacturers and sells them to retailers. The company began operations at the beginning of 2018. The following information is available about Simpson's operation: • Simpson's suppliers allow it 30 days to pay for purchases. Assume purchases are made evenly throughout the year. Simpson allows customers 60 days to pay for their purchases. Assume sales occur evenly throughout the year. • Simpson has a markup on its product of 100 percent....

  • Module Two: Merchandising for a Profit                      Operating Income (Gross Sales and...

    Module Two: Merchandising for a Profit                      Operating Income (Gross Sales and Net Sales)                       1. Return Percentages: Customer returns and allowances for Department #620 came to $5,500. Gross sales in the department were $100,000. What percentage of merchandise sold was returned?                      Customer returns and allowances   $5,500       Gross sales   $100,000       Return Percentage                      2. Net Sales $: If gross sales...

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
ADVERTISEMENT