Write a Programmer that will develop a software called VACCINE_OPTION, that will determine the correct vaccine for every candidate. The available vaccines are Moderna, mRNA, Johnson & Johnson’s Janssen and Pfizer-BioNTech
The software should determine the type of vaccine a candidate should receive based on their temperature. Use the switch statement to determine the right vaccine for candidate by using their temperature readings
1. 30-33 for Mordena
2. 34-36 mRNA
3. 37-38 Johnson and Johnson’s Janssen
4. 39-40 Pfizer-BioNTech
The program must be able to read temperatures up to four(4) decimal places after the comma and use an appropriate library to convert it to two(2) decimals after the comma,
people that are vaccinated:
Jay Snow 34,37 mRNA
Chris Van 37,66 Johnson and johnson’s Janssen
Charles Smith 32,55 Mordena
Norwell Sky 39,78 pFizer-BioNTech
-Use an appropriate operator to convert an expression to a specified type
-manage the alignments in the summary of your candidates
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double temp;
cout<<"\nEnter temperature: ";
cin>>temp;
int n;
if (temp>=30 && temp<=33)
n=1;
else if (temp>=34 && temp<=36)
n=2;
else if (temp>=37 && temp<=38)
n=3;
else if (temp>=39 && temp<=40)
n=4;
string vaccine="";
switch(n){
case 1:
vaccine="Mordena";
break;
case 2:
vaccine="mRNA";
break;
case 3:
vaccine="Johnson and Johnson’s Janssen";
break;
case 4:
vaccine="Pfizer-BioNTech";
break;
}
cout<<"\nThe temperature is: "<<fixed<<setprecision(2)<<temp;
cout<<"\nAnd the suitable vaccine is: "<<vaccine<<endl;
return 0;
}
Comments
Leave a comment