Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Robert Corrato
- //9/6/19
- //B Block
- import java.util.*;
- class TemperatureGameOTG{
- public static void main(String[] args) {
- int temperature;
- int answer;
- Scanner sc = new Scanner(System.in);
- System.out.println("Do you want to convert fahrenheit or celcius?"xxl)
- answer = sc.nextLine();
- if (answer = "fahrenheit"){
- System.out.println("Enter temperature in fahrenheit");
- temperature = sc.nextInt();
- temperature = ((temperature - 32)*5)/9;
- System.out.println("The temperature in celsius is " + temperature);
- }
- else
- {
- System.out.println("Enter temperature in celcius");
- temperature = sc.nextInt();
- temperature = ((temperature (9.0/5 * C)) + 32;
- System.out.println("The temperature in fahrenheit is " + temperature);
- }
- }
- }
- System.out.println("Convert another temperature? 1 for yes.");
- int playAgain = sc.nextInt();
- if (playAgain != 1){
- play = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement