![]() ![]() formatted because I'm based in the US, but I can't round down Celsius at the same time. I'd like to use WeatherKit, but I'm having trouble rounding Celsius down to no decimal places. If no input specified the assignment tells you what values to put.I have a weather app that tells the temperature in Celsius and Fahrenheit at the same time. The degree Celsius is the unit of temperature on the Celsius scale (originally known as the centigrade scale outside Sweden), one of two temperature scales used in the International System of Units (SI), the other being the Kelvin scale. On the Fahrenheit scale the boiling point of water is 212 ☏, the freezing point of water is 32 ☏ and absolute zero is 459.67 ☏. Yes, because thats setting the units for the entire app. Based on the input calculate the fahrenheitTemp, celsiusTemp like I did in the setDegree. A temperature such as 72 ☏ is stated 'seventy-two degrees Fahrenheit'. Use the instructions of the assignment to create the 4 constructors. Meaning that your set methods should have arguments and will pass that argument to the class variable. When you set the degree (by Constructor or be a set Method), use the scale to see if it is Celsius or Fahrenheit and use the appropriate formula: public void setDegrees(float degree) ('f degrees Celsius is f degrees Fahrenheit',celsius,fahrenheit) The reason I did all this is mainly just simple syntax. So don't put any calculations in your get Methods. Well just to fix your error: (celsius + 'degrees Celsius is ' + fahrenheit + ' degrees Fahrenheit') or you could do this if you want to use printf. So you will use the scale to determine that and calculate the results accordingly. When you have a degree as a parameter you don't know if it is in Celsius or in Fahrenheit. IF ANYONE WULD BE ABLE TO HELP ME WITH MY ERRORS IN MY CONSTRUTOR METHOD OR AS LEAST LET ME KNOW WHAT I DID WRONG THAT WOULD GREATLY BE APPRECIATED. Be sure to invoke each of the constructors, to include at least one case where the 2 temperatures are the same and one where they are different. Write a driver program that tests all the methods. If load weather app, then it changes to Celsius on the tile, but when the computer starts - it shows F.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |