In: Computer Science
Write a program that implements the pseudocode ("informal
high-level description of the operating principle of a computer
program or other algorithm") below:
1. Ask the user for the size of their apartment in square meters
(size)
2. Convert the size to square feet using the formula: convertedSize
= size * 10.764
3. Print out the converted size.
Have meaningful prompts and meaningful explanation of any numbers
printed.
Program:
import java.util.Scanner;
public class MeterToFeetConversion {
public static void main(String[] args) {
System.out.print("Please enter
the size of apartment in square meters : ");
// Create Scanner object to get
user input
Scanner in = new
Scanner(System.in);
// get user input for size of
apartment in square meters
float inputMeters =
in.nextFloat();
// convert size of apartment from
square meter to square feet
float meterToFeet = (float)
(inputMeters * 10.764);
// print the size of apartment in
square feet
System.out.println("The size of
apartment in square feet : " + meterToFeet);
}
}
Sample Output:
Please enter the size of apartment in square meters : 2
The size of apartment in square feet : 21.528