Question

In: Computer Science

A store has 4 categories A, B, C and D, create a program that asks you...

A store has 4 categories A, B, C and D, create a program that asks you 10 times the sale and the category so that at the end it shows you the total by category, and the sum of all. Code in C # and Python

Solutions

Expert Solution

times=10

a_val=0

b_val=0

c_val=0

d_val=0

while(times):

    cat=str(input("Enter category(A, B, C, D): "))

    val=int(input("Enter sales: "))

    if cat=='A':

        a_val+=val

    elif cat=='B':

        b_val+=val

    elif cat=='C':

        c_val+=val

    elif cat=='D':

        d_val+=val

    else:

        print("Category invalid. Enter again")

        times+=1

    times-=1

print("Sales in category A= "+str(a_val))

print("Sales in category B= "+str(b_val))

print("Sales in category C= "+str(c_val))

print("Sales in category D= "+str(d_val))

print("Total sales= "+str(a_val+b_val+c_val+d_val))

#SAMPLE OUTPUT

PLEASE LIKE IT RAISE YOUR THUMBS UP
IF YOU ARE HAVING ANY DOUBT FEEL FREE TO ASK IN COMMENT SECTION


Related Solutions

A department store, A, has four competitors: B,C,D, and E. Store A hires a consultant to...
A department store, A, has four competitors: B,C,D, and E. Store A hires a consultant to determine if the percentage of shoppers who prefer each of the five stores is the same. A survey of 1100 randomly selected shoppers is conducted, and the results about which one of the stores shoppers prefer are below. Is there enough evidence using a significance level α = 0.05 to conclude that the proportions are really the same? Store A B C D E...
Using C++ Create a program that asks the user to input a string value and then...
Using C++ Create a program that asks the user to input a string value and then outputs the string in the Pig Latin form. - If the string begins with a vowel, add the string "-way" at the end of the string. For “eye”, it will be “eye-way”. - If the string does not begin with a vowel, first add "-" at the end of the string. Then rotate the string one character at a time; that is, move the...
Find the value of a : b : c : d, if a : b = 2 : 3, b : c = 4 : 5 and c : d = 6 : 7.
Find the value of a : b : c : d, if a : b = 2 : 3, b : c = 4 : 5 and c : d = 6 : 7.
In c++ create a program that asks for tire shop sales numbers made by 0 to...
In c++ create a program that asks for tire shop sales numbers made by 0 to 20 employees Premium tires sell for $300 and standard tires sell for $250 The wholesale cost of premium tires is $120 and the standard is $100 The program must ask for each employee's name and then the amount of premium and standard tires sold. Output the name and the total profit each employee made for the shop Output the total profits earned between all...
In BitTorrent, consider peer A is connected to peers B, C, D and E. A asks...
In BitTorrent, consider peer A is connected to peers B, C, D and E. A asks the other peers for list of chunks that they have. B, C, D and E have the following chunks that are missing to A: B – C1, C3 C – C1, C3, C5 D – C3, C4, C5 E – C2, C4 Which is the chunk that A requests first, and from which peer?
Given A*B*C and A*C*D, prove the corollary to Axion B-4.
Given A*B*C and A*C*D, prove the corollary to Axion B-4.
create a decision tree for a,b,c,d what do u need? a,b,c,d are the elements that needs...
create a decision tree for a,b,c,d what do u need? a,b,c,d are the elements that needs to be sorted
4. Devos inc has 4 teams (A, B, C, D) and 4 (1, 2, 3, 4)...
4. Devos inc has 4 teams (A, B, C, D) and 4 (1, 2, 3, 4) potential tasks. The total amount of days each employee would need to allocate to each job is as follows: ​ Potential Tasks Team 1 2 3 4 A 28 33 21 35 B 41 43 23 37 C 48 28 33 42 D 49 27 43 46 Use Excel solver Match the team the most efficient task. What is the total number of days...
In C Programming Create a payroll program to store and calculate the payroll for a small...
In C Programming Create a payroll program to store and calculate the payroll for a small company as follows: Ask the user for the number of employees and only accept the number if it is between 5 and 40 employees, otherwise prompt the user again and test the input, keep repeating until the user enters an acceptable number. Create an array of floats that is 4 rows and an number of columns equal to the number of employees in the...
1. Evaluate: (a+b)/(c-d) + 9/(a+d) when a=5, b=3, c=8, d=4 a. 6 b. 3 c. 15/2...
1. Evaluate: (a+b)/(c-d) + 9/(a+d) when a=5, b=3, c=8, d=4 a. 6 b. 3 c. 15/2 d. 17/13 2. Solve for x: 5(x+3) = 35 a. 2 b. 7 c. 4 d. -4 3. Acid rain occurs primarily as a result of a. operating a nuclear power plant b. burning coal or oil containing sulfur c. by-products created by operating an oil refinery d. the use of Freon and other refrigerants 4. The "ozone holes" at the polar region arise...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT