Ask your own question, for FREE!
Computer Science 21 Online
psirockin2:

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?

psirockin2:

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).

psirockin2:

I already declared freezing point as final double FREEZING_POINT = 32;

psirockin2:

Basically all I'm asking is for someone to correct me if I'm screwing something up

psirockin2:

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?

AngeI:

I think it would be tf=64 e.e

psirockin2:

but if it says int... maybe just int Tf = 64?

AngeI:

I meant that but was too lazy to type out the whole thing

psirockin2:

okay so int Tf = 64;

AngeI:

That's what I would go with

psirockin2:

Uh next step now? Are you able to help me further?

AngeI:

I wouldn't call this help but uh, I'll try my best e.e

psirockin2:

wants me to calculate equivalent Celsius temperature would I do int Tc = (the formula goes here?)

psirockin2:

int Tc = (5/9 (Tf -32);

psirockin2:

this

AngeI:

Uhhhh, ima be honest with you and say I have no clue. Do you only have one submission?

psirockin2:

I have multiple but it ends at midnight and I don't see the grade immediately

psirockin2:

So this is a crapshoot

psirockin2:

Any grade is better than a zero at this point

psirockin2:

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); } }

dude:

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

AngeI:

Sorry I had to suddenly get off my phone

dude:

``` 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); } }

dude:

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)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!