need help with writing up this code it must be coded in Microsoft visual studios
ID: 3602842 • 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()
{
//variables
int N;
int i=0;
int temp_val;
char prompter='Y';
int low_temp=0,norm_temp=0,high_temp=0;
int temp_sum=0;
while(prompter=='Y')
{
cout<<"Enter temperature-"<<i+1<<" value"<<endl;
cin>>temp_val;
temp_sum=temp_sum+temp_val;
//catagerozing and counting the temperatures
if(temp_val<10)
{
low_temp++;
}
else if(temp_val>=10 && temp_val<=35)
{
norm_temp++;
}
else{
high_temp++;
}
cout<<endl<<"Do you want to continue? Press Y for yes or N for no"<<endl;
cin>>prompter;
i++;
}
N=i;
//calculation of average=(sum of temperatures)/(total no. of temperatures)
int temp_avg=temp_sum/N;
cout<<endl<<"No. of low temperatures: "<<low_temp<<endl;
cout<<"No. of normal temperatures: "<<norm_temp<<endl;
cout<<"No. of high temperatures: "<<high_temp<<endl<<endl;
cout<<"Average temperature is: "<<temp_avg<<endl;
return 0;
}
//IDE_REPORT
system("pause") pauses a program until some button is pressed.
It is used to execute pause.exe which holds the command window open, to view the output of the program.
getchar() function can be used instead of system("pause") for the same functionality.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.