public static void Main()
double adultMedicationDose;
char calculatorSelection;
Console.WriteLine("Body Surface Area / Adjusted Dosage Calculator");
Console.WriteLine("==============================================");
Console.WriteLine("Please enter 'A' if you want to compute patient Body Surface Area");
Console.WriteLine("Please enter 'B' if you want to compute Adjusted Medication Dosage for child patient ");
calculatorSelection = Convert.ToChar(Console.ReadLine().ToLower());
if (calculatorSelection == 'a' || calculatorSelection == 'b')
Console.WriteLine("Please enter a valid input");
calculatorSelection = Convert.ToChar(Console.ReadLine().ToLower());
Console.WriteLine("\nThis calculator allows you to enter both imperial and metric units\nPlease enter 'I' if you want to use imperial units\nPlease enter 'M' if you want to use metric units");
unitSelection = Convert.ToChar(Console.ReadLine().ToLower());
if (unitSelection == 'i' || unitSelection == 'm')
Console.WriteLine("Please enter a valid input");
unitSelection = Convert.ToChar(Console.ReadLine().ToLower());
if (calculatorSelection == 'a')
Console.WriteLine("\nThis calculator allows you to calculate patient body surface area using either the DuBois formula or the Gehan formula");
Console.WriteLine("\nPlease enter 'D' to calculate patient body surface area using either the DuBois formula\nPlease enter 'G' to calculate patient body surface area using or the Gehan formula");
equationSelection = Convert.ToChar(Console.ReadLine().ToLower());
if (equationSelection == 'g' || equationSelection == 'd')
Console.WriteLine("Please enter a valid input");
unitSelection = Convert.ToChar(Console.ReadLine().ToLower());
if (unitSelection == 'i')
Console.WriteLine("Patient height in inches:");
height = Convert.ToDouble(Console.ReadLine());
height = height * 0.0254;
Console.WriteLine("Patient weight in pounds:");
weight = Convert.ToDouble(Console.ReadLine());
weight = weight * 0.453592;
Console.WriteLine(CalculateBSA(height, weight, equationSelection));
Console.WriteLine("Patient height in meters:");
height = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Patient weight in kilograms:");
weight = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(CalculateBSA(height, weight, equationSelection));
if (calculatorSelection == 'b')
Console.WriteLine("Please enter adult medication dose in milligrams:");
adultMedicationDose = Convert.ToInt32(Console.ReadLine());
if (unitSelection == 'i')
Console.WriteLine("Patient weight in pounds:");
weight =Convert.ToDouble(Console.ReadLine());
weight = weight * 0.453592;
Console.WriteLine(CalculateAdjustedDosage( weight, adultMedicationDose));
Console.WriteLine("Patient weight in kilograms:");
weight = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(CalculateAdjustedDosage( weight, adultMedicationDose));
public static string CalculateBSA(double height, double weight, char formulaInd)
x = (0.20247) * (Math.Pow(height, 0.725)) * (Math.Pow(weight, 0.425));
result = "Body Surface Area: " + Convert.ToString(x) + "m^2";
x = (0.0235) * (Math.Pow((height * 100), 0.42246)) * (Math.Pow(weight, 0.51456));
result = "Body Surface Area for this patient is: " + Convert.ToString(x) + "m^2";
public static string CalculateAdjustedDosage(double weight, double adultDosage)
var percent = (weight * 2)/100;
x = adultDosage * percent;
var percent = (weight + 30)/100;
x = adultDosage * percent;
result = "The Adjusted Dosage for this medication is " + x + "mg";