write aJava program to input height of a student in inches. convert the height into feet and inches. print the height and the converted height in feet and inches. (where 1 feet = 12 inches) using scanner class
Answers
Answer:
Bidenimport java.util.Scanner;
public class MathUnitConversions4 {
public static void main(String[] args) {
double feet;
Scanner in = new Scanner(System.in);
System.out.println("Please enter feet:");
feet = in.nextDouble();
double inches = feet * 12;
System.out.println(inches + " Inches");
}
}
Output:
Please enter feet:
15
180.0 Inches
Explanation:
please mark me as bralyest!!!
Answer:
import java.util.*;
public class Main {
public static void main(String[] args) {
double hgt_inc, hgt_ft;
Scanner obj = new Scanner(System.in);
System.out.println("\t Input height ");
hgt_inc = obj.nextDouble();
hgt_ft = hgt_inc / 12;
System.out.println("\t Your height in inches "+hgt_inc);
System.out.println("\t Your height in feet and inches is "+hgt_ft+"feet");
}
}