Question #240691

Given Create a program that when run with a name, an integer and a double as CMD arguments, it prints out a greeting using the name and also print the difference of the two given numbers: Sample run 1:  



Expert's answer

public class Main {
    public static void main(String[] args) {
        String name = args[0];
        int intNumber = Integer.parseInt(args[1]);
        double doubleNumber = Double.parseDouble(args[2]);

        double difference = intNumber - doubleNumber;

        System.out.println("Hello " + name);
        System.out.println("Difference: " + difference);
    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS