I would like to know if I can get some help on my Programming assignment 11. I have inputed everything in Visual studio and I got one error wrong which is std::cout << std::setprecision(2); can you please help me figure out what I need to do to change this and make it correct. This is due today.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I would like to know if I can get some help on my Programming assignment 11. I have inputed everything in Visual studio and I got one error wrong which is std::cout << std::setprecision(2); can you please help me figure out what I need to do to change this and make it correct. This is due today.

 


#include <iostream>
 

using namespace std;

int calcAverage(int s1,int s2,int s3,int s4)
{
int res = s1;

if(s2<=s1 && s2<=s3 && s2<=s4) // if s2 is lowest
res = s2;

if(s3<=s1 && s3<=s2 && s3<=s4) // if s3 is lowest
res = s3;

if(s4<=s1 && s4<=s2 && s4<=s3) // if s4 is lowest
res = s4;

return res;
}
int main() {

cout<<"Enter four test cases seperated by space:"<<" ";
int s1,s2,s3,s4; // 4 type of sales..
cin>>s1>>s2>>s3>>s4; // taking input...

int x = calcAverage(s1,s2,s3,s4); /// find lowest sales

int total = s1+s2+s3+s4; // total of all sales


total -= x; // subtracting minimum amount from it;

double avg = (total*1.0)/3.0; // taking average of 3 maximum sales;

cout<<"After dropping the lowest score "<<x<<", the test average is ";
std::cout << std::fixed;
std::cout << std::setprecision(2);
cout<<avg<<"."<<endl;

}

Follow instructions to create a visual C++ project, add the C++ code, compile, run and fix errors. Save it to
your Lab Assignment Folder in your Z drive or to your laptop.
Write your Name, course, and date as comments on first line.
// First and last name
CSDP 221 Program 11 4/12/2021
> Explain what the program is to do along with any directions or instructions needed for program
users
Add comments to
your
code
Write a program that calculates the
The program should have a void function named calcAverage that calculate and display the average of the
three highest scores. This function should be called by main and should be passed the four scores and the lowest
test score. The average should be displayed to two decimal places with the decimal points always show.
average
of a
group
of four test scores after dropping the lowest test score.
Expected outputs:
A Microsoft Visual Studio Debug Console
Enter four test scores seperated by space: 81 67 96 73
After dropping the lowest score 67, the test average is 83.33.
Hints:
To find the highest sales:
if (sales1> sales2 && sales1 > sales3 && sales1 > sales4)
Transcribed Image Text:Follow instructions to create a visual C++ project, add the C++ code, compile, run and fix errors. Save it to your Lab Assignment Folder in your Z drive or to your laptop. Write your Name, course, and date as comments on first line. // First and last name CSDP 221 Program 11 4/12/2021 > Explain what the program is to do along with any directions or instructions needed for program users Add comments to your code Write a program that calculates the The program should have a void function named calcAverage that calculate and display the average of the three highest scores. This function should be called by main and should be passed the four scores and the lowest test score. The average should be displayed to two decimal places with the decimal points always show. average of a group of four test scores after dropping the lowest test score. Expected outputs: A Microsoft Visual Studio Debug Console Enter four test scores seperated by space: 81 67 96 73 After dropping the lowest score 67, the test average is 83.33. Hints: To find the highest sales: if (sales1> sales2 && sales1 > sales3 && sales1 > sales4)
Expected outputs:
noone
A Microsoft Visual Studio Debug Console
Enter four test scores seperated by space: 81 67 96 73
After dropping the lowest score 67, the test average is 83.33.
Hints:
To find the highest sales:
if (sales1> sales2 && sales1 > sales3 && sales1 > sales4)
{
highestSales = sales1;
}
else if (sales2 > sales1 && sales2 > sales3 && sales2> sales4)
{
highestSales = sales2;
}
else if (sales3 > sales1 && sales3 > sales2 && sales3 > sales4)
{
highestSales = sales3;
}
else
{
highestSales = sales4;
}
Transcribed Image Text:Expected outputs: noone A Microsoft Visual Studio Debug Console Enter four test scores seperated by space: 81 67 96 73 After dropping the lowest score 67, the test average is 83.33. Hints: To find the highest sales: if (sales1> sales2 && sales1 > sales3 && sales1 > sales4) { highestSales = sales1; } else if (sales2 > sales1 && sales2 > sales3 && sales2> sales4) { highestSales = sales2; } else if (sales3 > sales1 && sales3 > sales2 && sales3 > sales4) { highestSales = sales3; } else { highestSales = sales4; }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Graphical User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education