If you have any doubts, please give me comment...
#include<stdio.h>
int main(){
int prod_no, quantity;
int prod1_qty=0, prod2_qty=0, prod3_qty=0, prod4_qty=0, prod5_qty=0;
double prod1_sales=0, prod2_sales=0, prod3_sales=0, prod4_sales=0, prod5_sales=0;
double total = 0.0;
printf("Please enter the product number between 1 and 5. -1 to end: ");
scanf("%d", &prod_no);
while(prod_no!=-1){
printf("Please enter quantity sold: ");
scanf("%d", &quantity);
switch(prod_no){
case 1:
prod1_qty += quantity;
prod1_sales += quantity*2.98;
break;
case 2:
prod2_qty += quantity;
prod2_sales += quantity*4.50;
break;
case 3:
prod3_qty += quantity;
prod3_sales += quantity*9.98;
break;
case 4:
prod4_qty += quantity;
prod4_sales += quantity*4.49;
break;
case 5:
prod5_qty += quantity;
prod5_sales += quantity*6.87;
break;
}
printf("Please enter the product number between 1 and 5. -1 to end: ");
scanf("%d", &prod_no);
}
total = prod1_sales + prod2_sales + prod3_sales + prod4_sales + prod5_sales;
printf("Product\t\tQty\tSales\n");
printf("Product 1:\t%d\t%.2f\n", prod1_qty, prod1_sales);
printf("Product 2:\t%d\t%.2f\n", prod2_qty, prod2_sales);
printf("Product 3:\t%d\t%.2f\n", prod3_qty, prod3_sales);
printf("Product 4:\t%d\t%.2f\n", prod4_qty, prod4_sales);
printf("Product 5:\t%d\t%.2f\n", prod5_qty, prod5_sales);
printf("\nTotal\t: %.2f\n", total);
return 0;
}

This is in C. 4.19 (Calculating Sales) An online retailer sells five different products whose retail...
An online retailer sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product 3, $9.98; product 4, $4.49 and product 5, $6.87. Write an application in C++ that reads a series of pairs of numbers as follows: a) product number b) quantity sold Your program should use a switch statement to determine the retail price for each product. It should calculate and display the total retail value of all products sold. Use the sentinel-controlled...
A mail order house sells five different products whose retail prices are: product 1: $2.98 product 2: $4.50 product 3: $9.98 product 4: $4.49 product 5: $6.87. Write a program that reads a series of pairs of numbers as follows: a) product number b) quantity sold Your program should use a switch statement to determine the retail price for each product. Your program should calculate and display the total retail value of all products sold. Use a sentinel-controlled loop to...
Amail-order housesellsfivedifferentproductswhoseretailpricesareasfollows:product1, $2.98; product 2, $4.50; product 3, $9.98; product 4, $4.49; and product 5, $6.87. Write a script that reads a series of pairs of numbers as follows: a) Product number b) Quantity sold for one day(html)
Programming language C. A small U-Pick farm sells five different U-Pick citrus fruit products whose retail prices are: 1. Sugarbells - $1.99/lb, 2. Honeybells - $2.39/lb, 3. Red Grapefruit $1.69/lb, 4. Navel Oranges - $1.49/lb, 5. Pomelo - $1.89/lb. Write a program that allows the user to select one or more products, input the weights of each product, and calculate the total amount due. The farm only accepts cash. Your program will take input of the cash received and calculate...
Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold (this is two separate prompts for input values). You must use a switch statement and a sentinel-controlled loop (i.e. a loop that stops execution when an out of range value, such as -1, is input). All 15 items below are for a single purchase. There are five sets of inputs as follows: Product 1 1...
matlab only
Question 4 A restaurant sells five different desserts whose prices are shown below in the following table: Dessert number Unit Price $ 3.98 $ 2.55 $6.90 $9.85 12.50 2 4 Write a Matiab program to display the above menu to the user. The program then prompts the customer for a key board entry of a series of pairs of numbers as follows Dessert Number: Quantity sold The program should then use switch statement to obtain the total price...
We use JAVA. Thanks. Create an application whose main method asks the user to enter an n by m integer matrix that contains nm integer numbers. n and m should be between 1 and 10. If the user enters a number less than 1 or greater than 10, the program will continue to ask the user to enter an integer number between 1 and 10. The program should print the sum of the boundary elements of the matrix....
Write a c++ complete program to meet the specifications. The program should prompt the user for a positive integer. The program should print a message whether the integer is even or odd. The looping should end when the user enters a negative number. The negative number will not be tested for even or odd. The program will print out a message of how many numbers were entered (not counting the negative number) and how many even and odd numbers were...
(C programing, Not C++) Write a program in C that asks the user to input 10 numbers. Store these numbers in an array. Then ask the user to input a single number. Your program should execute a linear search on the array, trying to find that number. If the number exists in the array, have the program print out which position/element the number was found at. If the target number is not in the array, have the program print out...
programing C,already write part of code
(a) Write a function print.array that receives an array of real numbers and the number of el stored in the array. This function must display the elements of the array in order with each one on a line by itself in a field width of 7 with two decimal places. (See sample output. Recall the format specifier would be "%7.21f"). (b) Sometimes we want to treat an array as a mathematical vector and compute...