BASIC JAVA NEWBIE, switch,if,else statements?

jay

Active member
Joined
May 16, 2008
Messages
1,374
Reaction score
0
Points
36
Guys I know I posted this question earlier, but didn't really get pushed into the right direction. The questions states:

The problem states, write a program that allows the user to convert a temperature given in degrees from either Celsius to Fahrenheit or Fahrenheit to Celsius. Use the following formulas:

Degrees_F = 5 (Degrees_F -32)/9
Degrees_C = (9(Degrees_C)/5+32)

Prompt the user to enter a temp and either a C or c for Celsius or an F or f for Fahrenheit. Convert the temp to Fahrenheit if Celsius is entered...vice versa. If anything other than C c F f is entered, print an error message and stop...

How would I go on to start the ACTUAL code of this, I'm lost and this is due today.
import java.util.Scanner;

public class temp

{
public static void main(String[]args);
{
Scanner keyboard = new Scanner(System.in);

double tempValue;

System.out.print("Please enter a temperature value");
tempValue = keyboard.nextInt();

System.out.println("Now enter either C or F");
String tempScale = Scanner.nextLine().toUpperCase();
 
Back
Top