Answer to Question #289637 in C++ for emnewfim

Question #289637

The maximum weight y (in pounds) for a man in the United States Marine Corps can be approximated by the mathematical model

y=0.040x2 −0.11x+3.9, 58≤x≤80

where x is the man’s height (in inches).

Design an algorithm and write a C++ program that prompts the user to input the height in inches. The program calculates and outputs the weight in pounds.


  


1
Expert's answer
2022-01-22T02:41:47-0500


Algorithm
Start
   Declare real heigh
   Declare real weight
   while height<58 or height>80
	Display "Input the height in inches [58-80]: "
	intput height
   End while
   Set weight=0.040*height*height-0.11*height+3.9
   Display "The weight: ",weight," pounds"
Stop






C++ program
#include <iostream>
#include <string>




using namespace std;




int main(void){
	float height=0;
	while(height<58 || height>80){
		cout<<"Input the height in inches [58-80]: ";
		cin>>height;
	}
	


	float weight=0.040*height*height-0.11*height+3.9;
	cout<<"The weight: "<<weight<<" pounds\n\n";
	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog