how do I do this using C++ and it says to use controlled sentinel loop? Applican
ID: 3692295 • Letter: H
Question
how do I do this using C++
and it says to use controlled sentinel loop?
Applicants applying for a post as policeman/policewomen must fulfill the following criteria: Age between 21-35 The physical qualification: The Body Mass Index (BMI) for all gender must be less than 25.0 * BMI Formula: weight (kg) / (height (m))^2 Develop a program to determine whether the applicant is qualified to apply or not State the reason, if the candidate does not qualified Check the criteria following the above order (age. physical and bmi). If the applicant does not meet the first criteria (age), your system does not have to check for the rest of the criteria Modify your program from Task 3 of Assignment 3. Your program should repeat the process for several applicants. Use SENTINEL control loop to achieve this taskExplanation / Answer
A sentinel is a special value, e.g. boolean value, extremely big or small. It is used to determine when to stop the loop.It can written in various ways.
here is your code..try this
#include <iostream>
using namespace std;
int main()
{
float age,ht,wt,bm;
char g;
cout<<"enter the age";
cin>>age;
cout<<"enter gender";
cin>>g;
cout<<"enter the height";
cin>>ht;
cout<<"enter the weight";
cin>>wt;
cout<<"enter body mass";
cin>>bm;
while(g!=0)
{
if(age>=21&&age<=35)
{
if(g=='m'&&ht>=1.63&&wt>=50&&bm<25)
{
cout<<"applicant pass";
}
else
{
cout<<"applicant failed the criteria";
}
if(g=='f'&&ht>=1.57&&wt>=48&&bm<25)
{
cout<<"applicat pass";
}
else
{
cout<<"applicant failed the criteria";
}
}
else
{
cout<<"your age dosen't match the required criteria";
}
return 0;
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.