[Java] Main.java

less than 1 minute read

import java.util.Scanner;

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

System.out.print (“name:”);
// Receive string input
String firstName = scanner.next();

System.out.print (“Last Name:”);
// Receive string input
String lastName = scanner.next();

System.out.print (“age:”);
// Receive integer input
int age = scanner.nextInt();

System.out.print (“height (m):”);
// Receive decimal input
double height = scanner.nextDouble();

System.out.print (“Weight (kg):”);
// Receive decimal input
double weight = scanner.nextDouble();

Person.printData(Person.fullName(firstName, lastName), age, height, weight);   } }

Tags:

Updated: