today i have an issue with this code i wrote. The problem comes when i try and run it with command prompt, it doesnt display the last line of code i wrote "Congratulations, the birth month is April" If anyone understands why it would be helpful!
CODE:
import java.io.*;
import java.util.Scanner;
public class Lab3_5{
// Global variable to hold sales is defined
static double age, weight, birthMonth;
public static void main(String[] args){
// Method calls
getAge();
getWeight();
getMonth();
}
// This module takes in the required user input
public static void getAge(){
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter your guess for age: ");
double age = keyboard.nextDouble();
if (age >= 25){
System.out.println("Congratulations, the age is 25 or less.");
}
}
// This module takes in the required user input
public static void getWeight(){
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter your guess for weight: ");
double weight = keyboard.nextDouble();
if (weight <= 128){
System.out.println("Congratulations, the weight is 128 or less.");
}
}
// This module takes in the required user input
public static void getMonth(){
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter your guess for birth month: ");
String birthMonth = keyboard.next();
if (birthMonth == "April"){
System.out.println("Congratulations, the birth month is April.");
}
}
}