In: Computer Science
A hospital supply company wants to market a program to assist with the calculation of intravenous rates. Design and implement a program that interacts with the user as follows: INTRAVENOUS RATE ASSISTANT Enter the number of the problem you wish to solve. GIVEN A MEDICAL ORDER IN CALCULATE RATE IN (1) ml/hr & tubing drop factor drops / min (2) 1 L for n hr ml / hr (3) mg/kg/hr & concentration in mg/ml ml / hr (4) units/hr & concentration in units/ml ml / hr (5) QUIT Problem> 1 Enter rate in ml/hr=> 150 Enter tubing's drop factor(drops/ml)=> 15 The drop rate per minute is 38....
Copyable Code:
import java.util.Scanner;
public class Cal
{
public static void main(String []args)
{
boolean flag = true;
while (flag)
{
Scanner sc = new Scanner(System.in);
System.out.println("(1) ml/hr & tubing drop factor drops /
min\n(2) 1 L for n hr ml / hr\n(3) mg/kg/hr & concentration in
mg/ml ml / hr\n(4) units/hr & concentration in units/ml ml /
hr\n(5) QUIT Problem\n");
System.out.print("\nEnetr your choice : ");
int choice = sc.nextInt();
switch(choice)
{
case 1 :
Scanner sc1 = new Scanner(System.in);
System.out.print("\nEnetr value in ml : ");
float ml = sc1.nextFloat();
System.out.print("\nEnetr value in hr : ");
float hr = sc1.nextFloat();
System.out.println("Result is : " + ml + "/" + hr*60 + " = " +
ml/(hr*60) + " drops/min\n\n");
break;
case 2 :
Scanner sc2 = new Scanner(System.in);
System.out.print("\nEnetr value in hr : ");
float n = sc2.nextFloat();
System.out.println("Result is : " + 1*1000 + "/" + n + " = " +
1*1000/n + " ml/hr\n\n");
break;
case 3:
System.out.print("\nUnder Process\n");
break;
case 4:
System.out.print("\nUnder Process\n");
break;
case 5:
flag = false;
break;
default:
System.out.println("Wrong Input\nTry Again.");
}
}
}
}