need help with writing up this code it must be coded in Microsoft visual studios
ID: 3607564 • Letter: N
Question
need help with writing up this code it must be coded in Microsoft visual studios thanks
a) Evaluate and use software development tools and techniques: a. Write a code without syntax errors, demonstrating your knowledge of yariables operators, while loop and conditional statements b. Document your program in accordance with industry practice a. Ensure that your code meets all software specification requirements, b. Ensure that your code meets all software specification requirements c. Demonstrate a fully working, user friendly program. Answer all relevant b) Software solution: demonstrating your knowledge of variables, operators, and if else statement demonstrating your knowledge of while loop questions in the oral part of the report, justifying your choices c) Demonstrate the knowledge and use of IDE A temperature sensor readings are recorded to the closest degree. Write a code that in ct+ microsft visual studios e receives N temperature values from the user, using a while loop. (E.g you can repeat the entry, asking the question "Do you want to continue? Press Y for yes or N for no".) Sorts each received temperature value into one of the three categories o "low temperature" for temperatures below 10 degrees o "nominal operating temperature" for temperatures from the range between 10 and 35 degrees o "high temperature" for temperatures above 35 degrees. Your code has to keep a running count of how many temperatures are in each of these three ranges, and report the number of each at the end Finally, calculates the average temperature value To demonstrate your knowledge of the development environment in use, answer the following What is the purpose of system("'pause") function in your code? Do you know of any other options that would allow you to get the same outcome?Explanation / Answer
#include <iostream>
using namespace std;
int main() {
int n,i = 0;
int count = 0;
char option;
double temp,ltemp,ntemp,htemp,sum;
sum = 0;
cout<<"Enter the number of temperatures to be analysed : ";
cin>>n;
while(i<=n)
{
cout<<" Enter the temperature : ";
cin>>temp;
if(temp < 10)
{
cout<<" low temperature";
ltemp++;
}
else if(temp>= 10 && temp <= 35)
{
cout<<" nominal operating temperature";
ntemp++;
}
else if(temp > 35)
{
cout<<" high temperature";
htemp++;
}
i++;
sum = sum + temp;
cout<<" Do you want to continue? press Y for Yes and N for No :";
cin>>option;
if(option == 'N')
break;
}
cout<<" Number of low temperatures : "<<ltemp;
cout<<" Number of nominal temperatures : "<<ntemp;
cout<<" Number of high temperatures : "<<htemp;
cout<<" Average temperature : "<<sum/(ltemp+ntemp+htemp);
return 0;
}
Output:
system("pause")
This command is used to stop the console window and pause the execution
cin.get() can also be used in its place
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.