Write a program that inputs two double values and then calculates various results. Let the two double values be called a and b, in that order. Print out a to the power of b, the absolute value of a, the value of b rounded to the nearest integer, the smallest integer greater than or equal to a, and the bigger of either a or b. Comment your solution to this post.
top of page
bottom of page
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double a = sc.nextDouble(); Scanner sa = new Scanner(System.in); double b = sa.nextDouble(); System.out.println(); double number1 = a*b; System.out.println(number1); double number2 = Math.round(a); System.out.println(number2); double number3 = Math.round(b); System.out.println(number3); double number4 = Math.min(a, b); System.out.println("The lowest number is " + number4); double number5 = Math.max(a, b); System.out.println("The highest number is " +number5); } }