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...
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...
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 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?
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
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...
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.
Write a C program that asks the user to enter 15 integer numbers and then store them in the array.
Write a C program that asks the user to enter 15 integer numbers and then store them in the array. Then, the program will find the second largest element in array and its index without sorting the array. For example, In this array {-55,-2,1, 2, -3, 0, 5, 9, 13, 1, 4, 3, 2, 1, 0}, the second largest element is 9 [found at index 7].
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what...
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what proportion of the progeny will phenotypically resemble the first parent? b) what proportion of the progeny will genotypically resemble neither parent?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT