Question

In: Computer Science

A customer has purchased 15 items in a department store.


A customer has purchased 15 items in a department store. Write a code segment to read the unit price and the quantity of each these 15 items and to compute and print its price (which is the unit price times the quantity). Also compute and print average price of the 15 items.

Solutions

Expert Solution

program in c language ;

#include
int main()
{
int sum=0,a=0,b=0,quantity=0;
int i;
float avg=0;
   for (i=1;i<=15;i++)
   {
   printf("enter price and quantity of item %d :\n",i);
   scanf("%d\n%d",&a,&b);
   sum += (a*b);
   quantity += b;
   }
   avg = sum/(float)15;
   printf("the total price is %d \n the average price is %.2f\n",sum,avg);
   return 0;
}


Related Solutions

The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.9 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.9 minutes and a standard deviation of 2.7 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.1 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (A) less than 10 minutes (B) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed with a mean of 9.3 minutes and a standard deviation of 2.5 minutes. 1) What is the probability that for a randomly chosen customer with a complaint the amount of time spent resolving the complaint will be less than 12 minutes? Write your answer to four decimal places. 2)  What is the probability...
the customer service center in a large New York department store has determined that the amount...
the customer service center in a large New York department store has determined that the amount of time spent with the customer about a complaint is normally distributed with the mean of 9.3 minutes and a standard deviation of 2.2 minutes what is the probability that 4 randomly chosen customer with the complaint the amount of time spent with solving the complaint will be as follows a less than 10 minutes be longer than 5 minutes see between 8 and...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.1 minutes and a standard deviation of 2.2 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 8.3 minutes and a standard deviation of 2.7 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 8.5 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
You are Kathryn Smith , a correspondent in the customer service department at Bradford's Department Store...
You are Kathryn Smith , a correspondent in the customer service department at Bradford's Department Store located at 214 Grant Avenue, Auburn, New York 13021. This morning (use today's date) you received the following letter from Mrs. Henrietta Daniels, an angry customer. Dear Customer Service Manager, I am really upset at the poor quality shades that you sell. Two months ago I purchased two pairs of your pleated shades in Wedgewood Blue at $35.99 each for my two bathroom windows....
A customer in a grocery store is purchasing three items. Write the pseudo code that will:...
A customer in a grocery store is purchasing three items. Write the pseudo code that will: • Ask the user to enter the name of the first item purchased. Then ask the user to enter the cost of the first item purchased. Make your program user friendly. If the user says the first item purchased is milk, then ask: “What is the cost of milk.” [This should work no matter what item is entered by the user. I might buy...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT