Member Avatar

Basically I need to write an application to calculate BMI using the formula; BMI = w/ (h/100) 2 The user must type in her height in centimeters and weight in kilograms, and the computer prints out the user's BMI. import java.util.Scanner; import java.text.DecimalFormat; public class BMI { public static void main(String args[ ]){ double pound = .453592; double inches = 2.54; Scanner scan = new Scanner(System.in); System.out.println("Enter in your weight: "); double weight = scan.nextDouble(); System.out.println("Enter in your height: " ); double height = scan.nextDouble(); weight = weight * pound ;// Converts pounds to kilograms height = height * inches …

Member Avatar
0
21
Member Avatar

How would I output this into: int main() I've tried: int main() { PostTemperatures; } [CODE]struct WeatherStation { string StationName; double Temperature; }; void PostTemperatures(WeatherStation BigBasin,WeatherStation Foothill, WeatherStation DeAnza, WeatherStation MiddleField, WeatherStation RedwoodCity) { cout<< "Enter reported temperatures..."<<"\n"<< "\n"; BigBasin; BigBasin.StationName = "Big Basin"; cout << "Weather Station " << BigBasin.StationName<<" : "; cin >> BigBasin.Temperature; Foothill; Foothill.StationName = "Foothill"; cout << "Weather Station " << Foothill.StationName<<" : "; cin >> Foothill.Temperature; DeAnza; DeAnza.StationName = "DeAnza"; cout << "Weather Station " << DeAnza.StationName<<" : "; cin >> DeAnza.Temperature; MiddleField; MiddleField.StationName = "MiddleField"; cout << "Weather Station " << MiddleField.StationName<<" : …

Member Avatar
0
4
Member Avatar

[B]I included my original code down below....Basically I need some input on where to start off. From what I can tell it seems that I will need to re-organize the code into functions, while implementing the new data structure. Any input would be greatly appreciated.[/B] This time the program would be written using functions instead of putting all the code in main(). You need to rewrite the software from Lab 02 so that it effects these changes. New data structure to represent the information that comes from each weather station: struct WeatherStation { string StationDesignation; double Temperature; }; Your new …

Member Avatar
0
5
Member Avatar

Everything runs fine, except the Lowest Temperature and HIghest Temperature do not output correctly. Also any suggestions on how I could implement vectors, Any help would be greatly appreciated. Thanks. [CODE] #include<iostream> using namespace std; int main() { int i(0); double Calc(double fahren); double Total(0),Celsius[5],Fahrenheit[5]; double CelciusLowTemp(0), FahrenheitLowTemp(0), CelciusHighTemp(0), FahrenheitHighTemp(0); double Mean_Celcius, Mean_Fahrenheit; cout<< "Enter reported temperatures..."<<"\n"<< "\n"; for(i=0;i<5;i++) //Loops { cout<<"Weather Station "<<i<<" = ";// Takes input for Reported Temperatures... cin>>Fahrenheit[i]; if (FahrenheitLowTemp < 0.1) //Conditionals FahrenheitLowTemp = Fahrenheit[i]; else (FahrenheitLowTemp > Fahrenheit[i]); FahrenheitLowTemp = Fahrenheit[i]; if (FahrenheitHighTemp < 0.1) FahrenheitHighTemp = Fahrenheit[i]; else (FahrenheitHighTemp < Fahrenheit[i]); FahrenheitHighTemp = …

Member Avatar
0
2
Member Avatar

BMI= w/(h/100)2 [CODE]double BMI = weight/(height*height)// Works when weight=kilograms, height= meters [/CODE] I need the output to be in kilograms and centimeters. Any help, much appreciated.

Member Avatar
0
2

The End.