My problems starts when I want to see the condition and then move to another line but there is no "goto" in java so I have no clue how to move from inside of this if and go to the next line one ther hand when I put return after that it doesn't run the code .... I would aprieciate I f you guys help me with this problem... source code is here :::
//package CaloriesCalculator
import java.util.Scanner;
class Main {
// @SuppressWarnings("null")
@SuppressWarnings("resource")
public static void main(String[] args) {
// Initiate a new Scanner
// here I have tried to use scanner
boolean run = true;
while(run){
@SuppressWarnings("resource")
Scanner userInputScanner = new Scanner(System.in);
System.out.print("\nIf you are Male Press 1, If you are Female Press 2 ");
int G = userInputScanner.nextInt();
if(G == 1)
{
System.out.print("Please Enter your Weight..");
int W = userInputScanner.nextInt();
if((W <300) && (W > 1)) {//error message
// my problems start here !! I need to have the next input here but it doesn't work
}
System.out.print("Please Enter your Weight..");
W= userInputScanner.nextInt();
return;
// int m;
System.out.print("Please Enter your Height");
int H = userInputScanner.nextInt();
System.out.print("Please Enter your Age..");
int A = userInputScanner.nextInt();
double BMR = 10*W + 6.25*H - 5*A +5 ;
if( BMR > 0) {System.out.print(" Your body needs the amount of calories : "+ BMR );}
else { System.out.print("Do you know you are a mess ? " );}
//int H = userInputScanner.nextInt();
// else {System.out.print("Please Enter valid weight");}
}
else if(G == 2)
{
System.out.print("Please Enter your Weight..");
int W = userInputScanner.nextInt();
System.out.print("Please Enter your Height");
int H = userInputScanner.nextInt();
System.out.print("Please Enter your Age..");
int A = userInputScanner.nextInt();
double BMR = 10*W + 6.25*H - 5*A -161 ;
if(BMR > 0)
{
System.out.print(" Your body needs the amount of calories : "+ BMR );
}
else
{
System.out.print("Do you know you are a mess ? " );
}
}
else
{
System.out.print(" Please put the right number or don't use program " );
}
}
}
}