In: Computer Science
IN JAVA PROGRAMMING
Write a complete Java program to do the following:
a) Prompt the user to enter the name of the month he/she was born in (example: September).
b) Prompt the user to enter his/her weight in pounds (example: 145.75).
c) Prompt the user to enter his/her height in feet (example: 6.5).
d) Display (print) a line of message on the screen that reads as
follows:
You were born in the month of September and weigh 145.75 lbs. and are 6.5 feet tall.
In case of any queries,please comment. I would be very happy to
assist all your queries.Please give a Thumps up if you like the
answer.
Program
import java.util.Scanner;
public class read
{
public static void main(String args[])
{
Scanner input = new Scanner (System.in);
float weight,height;
String month;
System.out.print("Enter the name of
the month you born : " );
month = input.nextLine();
System.out.print("Enter your weight
in pounds: " );
weight = input.nextFloat();
System.out.print( "Enter your
height in feet : ");
height = input.nextFloat();
System.out.println( "You were
born in the month of "+month+" and weigh "+weight+" lbs. and are
"+height+" feet tall.");
}
}
Output
Enter the name of the month you born : September
Enter your weight in pounds: 145.75
Enter your height in feet : 6.5
You were born in the month of September and weigh 145.75 lbs. and
are 6.5 feet tall.
Screenshot