1. Engineering
  2. Computer Science
  3. write a program that receives the following information with the...

Question: write a program that receives the following information with the...

Question details

Write a program that

  • Receives the following information (with the exact order) from the user and stores them in appropriate variables (Make sure that you prompt the user before they enter each of the values):
    • Name (String)
    • Height in Centimeters (double)
    • Weight in Kilograms (double)
  • Based on the values that the users entered, print the below sentence to the console (replace the brackets with the correct and accurate values calculated based on user's inputs and do not print the quotations.):
    • "Hi [Name]! You are [x] meters tall and [z] pounds."
  • Note 1: 1 meter is 100 centimeter. So, 180 Centimeter is 1.8 meter.
  • Note 2: 1 Kilograms is 2.2 pounds.

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);

/* Type your code here. */
String name;
double heightInCm;
double weightInKg;
double heightInM;
double weightInPounds;
heightInM = heightInCm/100.0;
weightInPounds = weightInkg/2.2;
name = scnr.nextLine();
heightInCm = scnr.nextDouble();
weightInKg = scnr.nextDouble();
System.out.println("Hi " + name + "!" + " You are " + heightInM + "meters tall and " +weightInPounds+ " pounds.");
I typed my code under the "/* Type your code here. */" but somehow it will not compiled. This is what it says Main.java:14: error: cannot find symbol weightInPounds = weightInkg/2.2; ^ symbol: variable weightInkg location: class Main 1 error

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution