Can anyone assist me with a programming thing for my java class? Like... in the next hour or so? The thing is due at midnight and despite going to tutoring and stuff, it still makes no sense. Also, what category would this go in?
This is part 1 For Part I, you will write a program to convert a temperature from Fahrenheit to Celsius and back again. Use the following formulas: Fahrenheit to Celsius: Tc = 5 / 9 ( Tf – 32 ) Celsius to Fahrenheit: Tf = ( Tc * 9 / 5 ) + 32 Tc is the temperature in Celsius, Tf is the temperature in Fahrenheit, and 32 is the freezing point of water (HINT: this never changes).
I already declared freezing point as final double FREEZING_POINT = 32;
Basically all I'm asking is for someone to correct me if I'm screwing something up
Next it tells me to declare temperature in Fahrenheit as an int Would that be public int Tf = 64 or really any number I wanted?
I think it would be tf=64 e.e
but if it says int... maybe just int Tf = 64?
I meant that but was too lazy to type out the whole thing
okay so int Tf = 64;
That's what I would go with
Uh next step now? Are you able to help me further?
I wouldn't call this help but uh, I'll try my best e.e
wants me to calculate equivalent Celsius temperature would I do int Tc = (the formula goes here?)
int Tc = (5/9 (Tf -32);
this
Uhhhh, ima be honest with you and say I have no clue. Do you only have one submission?
I have multiple but it ends at midnight and I don't see the grade immediately
So this is a crapshoot
Any grade is better than a zero at this point
Screw it, I'm going with this and hoping for the best because my compiler isn't cooperating public class Kline_ProgrammingAssignment01 { public static void main( String [] args ) { // PART I. TEMPERATURE CONVERSION //***** 1. declare any constants here final double FREEZING_POINT = 32.0; //***** 2. declare temperature in Fahrenheit as an int int Tf = 64.0; //***** 3. calculate equivalent Celsius temperature int Tc = (5/9 (Tf -32); //***** 4. output the temperature in Celsius System.out.println(Tc); //***** 5. convert Celsius temperature back to Fahrenheit int Tf = ( Tc * 9 / 5 ) + 32; //***** 6. output Fahrenheit temperature to check correctness System.out.println(Tf); } }
Uh I tried doing this with an online compiler https://www.tutorialspoint.com/compile_java_online.php I toyed around with it and did this Also, @Ultrilliam send help
Sorry I had to suddenly get off my phone
``` public class Kline_ProgrammingAssignment01 { public static void main( String[] arg) { // PART I. TEMPERATURE CONVERSION //***** 1. declare any constants here double FREEZING_POINT = 32.0; //***** 2. declare temperature in Fahrenheit as an int int Tf = 64; //***** 3. calculate equivalent Celsius temperature int Tc = (Tf-32)*5/9; //***** 4. output the temperature in Celsius System.out.println(Tc); //***** 5. convert Celsius temperature back to Fahrenheit int Cf = ( Tc * 9 / 5 ) + 32; System.out.println(Cf); //***** 6. output Fahrenheit temperature to check correctness System.out.println(Tf); } }
It returns the values of Tf, Cf [Celsius back to Fahrenheit] and the Tf Because it is an int value, it rounds up/down so it doesn't return to 64 (That's what I got at least)
Join our real-time social learning platform and learn together with your friends!