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

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

ID: 3566201 • Letter: C

Question

C++ Do Q5 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, min = -1;
int numCount;

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

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

if(min < 0 || num < min) // first time minimum is set to -1
min = num;
}

if(min < 0 ){
// we will reach here only if no numbers are entered or all numbers entered are negative
cout << "No non-negative number entered";
}
else{
cout << "Minimum number is: " << min;
}

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote