Code a Java temperature converter in 7 minutes! ๐ŸŒก๏ธ @BroCodez
Code a Java temperature converter in 7 minutes! ๐ŸŒก๏ธ  @BroCodez
Uploaded December 2024 | Updated September 2026, 1 week ago
#java #javatutorial #javacourse

import java.util.Scanner;

public class Main {
public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

double temp;
double newTemp;
String unit;

System.out.print("Enter the temperature: ");
temp = scanner.nextDouble();

System.out.print("Convert to Celsius or Fahrenheit? (C or F): ");
unit = scanner.next().toUpperCase();

// (condition) ? true : false
newTemp = (unit.equals("C")) ? (temp - 32) * 5 / 9 : (temp * 5 / 9) + 32;

System.out.printf("%.1fยฐ%s", newTemp, unit);

scanner.close();
}
}
Code a Java temperature converter in 7 minutes! ๐ŸŒก๏ธLearn BREAK & CONTINUE in 2 minutes! ๐ŸšฆLearn OVERLOADED CONSTRUCTORS in 6 minutes! ๐Ÿ› ๏ธPython Full Course for free ๐ŸLets code a Python NUMBER GUESSING GAME! ๐Ÿ”ขLearn Python iterators in 7 minutes! โžก๏ธMatplotlib bar charts in 4 minutes! ๐Ÿ“ถCalloc in C is easy! ๐ŸงนLets code an alarm clock with Java! โฐLets code a weight converter with C programming! ๐Ÿ‹๏ธConvert decimal to hexadecimal EASY!  #coding #programming #computerscienceLayout managers in Python are easy! ๐Ÿงฒ
Bro Code |

Code a Java temperature converter in 7 minutes! ๐ŸŒก๏ธ

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER