Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Do Q6 Use Visual studio not Java A mail-order house sells five products whos

ID: 3566203 • Letter: C

Question

C++ Do Q6 Use Visual studio not Java A mail-order house sells five products whose retail prices are as follows: nr0dun 1 $2.98; product 2. $4.50; product 3, $9.98; product 4, $4.49 and product 5 $6 87 w an application that reads a series of pairs of numbers as follows: product number 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 a sentinel-controlled loop to determine when the program should stop looping and display the final results. Find the minimum of a sequence of nonnegative numbers entered by the user, where the user enters a negative number to terminate the input. Find the minimum of a sequence of nonnegative numbers entered by the user. In this time, before reading the numbers, ask the user to enter how many numbers will be input. Find the average of a sequence of nonnegative numbers entered by the user. In this time, before reading the numbers, ask the user to enter how many numbers will be input. Find the maximum, minimum, and average of a sequence of nonnegative numbers entered by the user. In this time, before reading the numbers, ask the user to enter how many numbers will be input

Explanation / Answer

#include <iostream>
using namespace std;

int main(){
   float num, sum = 0;
   int numCount, count;

   cout << "Enter the total number of numbers to be entered" << endl;
   cin >> numCount;
   count = numCount;

   while(numCount--) // will run exactly the entered value times
   {
       cin >> num; // input number

       sum += num; // add all the numbers to sum 1 by 1
   }

   cout << "The average is: " << sum/count; // average = total sum/ total count
   return 0;
}