Question: The aim is to write a program to decide the of medicine dosage based on the patient body weight. The logic of deciding the dosage
The aim is to write a program to decide the of medicine dosage based on the patient body weight. The logic of deciding the dosage depends weight and it is described in the following (if... else if) below. You are required to write the C++ program by converting the (if else if) to (switch) statement. #include using namespace std; int main () { // step 1: define the variables int weight; double dose; // step 2: read the variables values from the user cout > weight; //Step3: write the if else if statement if (weight == 50) { dose = weight * 0.02; cout << "The required dose for 50 Kg is = " << dose << endl; } else if (weight == 60) { dose = weight * 0.035; cout << "The required dose for 60 Kg is = " << dose << endl; } else if (weight == 70) { dose= weight * 0.041; cout << "The required dose for 70 Kg is = " << dose << endl; } else { cout << "Refer to doctor " << endl; } return 0; } . Draw the flowchart of the problem that described .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
