Lets code a WEIGHT CONVERTER in Java! ๐Ÿ‹๏ธ @BroCodez
Lets code a WEIGHT CONVERTER in Java! ๐Ÿ‹๏ธ  @BroCodez
Uploaded December 2024 | Updated September 2026, 2 weeks ago
#java #javatutorial #javacourse

import java.util.Scanner;

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

// WEIGHT CONVERSION PROGRAM

Scanner scanner = new Scanner(System.in);

double weight;
double newWeight;
int choice;

System.out.println("Weight Conversion Program");
System.out.println("1: Convert lbs to kgs");
System.out.println("2: Convert kgs to lbs");

System.out.print("Choose an option: ");
choice = scanner.nextInt();

if(choice == 1){
System.out.print("Enter the weight in lbs: ");
weight = scanner.nextDouble();
newWeight = weight * 0.453592;
System.out.printf("The new weight in kgs is: %.2f", newWeight);
}
else if(choice == 2){
System.out.print("Enter the weight in kgs: ");
weight = scanner.nextDouble();
newWeight = weight * 2.20462;
System.out.printf("The new weight in lbs is: %.2f", newWeight);
}
else{
System.out.println("That was not a valid choice");
}

scanner.close();
}
}
Lets code a WEIGHT CONVERTER in Java! ๐Ÿ‹๏ธNumPy arithmetic is easy! โœ–๏ธLearn Java Object Oriented Programming in 10 minutes! ๐ŸงฑPython PyQt5 RADIO BUTTONS are easy! ๐Ÿ”˜How to SEARCH an ARRAY easy! ๐Ÿ”ŽNumPy multidimensional arrays are easy! ๐ŸงŠLearn DATES & TIMES with Java in 8 minutes! ๐Ÿ“†Lets code a NUMBER GUESSING GAME in C! โ†•๏ธLearn Python generators in 8 minutes! ๐ŸšฐLearn Java inheritance in 9 minutes! ๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆStart using NumPy in 5 minutes! ๐Ÿ”ขYoull love Python data classes! ๐Ÿ“‹
Bro Code |

Let's code a WEIGHT CONVERTER in Java! ๐Ÿ‹๏ธ

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER