In: Computer Science
USING jgrasp environment, javascript
rite a complete program that prompts the user for two integers and then prints the following report to the screen, exactly as shown. example, using 23 and 18 as the user input:
your numbers are :23 and 18
sum=41
product=414
use the scanner class nextlnt() method to read the user's numbers: scanner keyboard... ...keyboard.nextlnt()
Thanks for the question. Here is the completed code for this problem. Comments are included so that you understand whats going on. Let me know if you have any doubts or if you need anything to change. Thank You !! ================================================================================================= import java.util.Scanner; public class Arithmetic { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.print("Enter two numbers separated by space: "); int firstNum, secondNum; //use the scanner class nextlnt() method to read the user's numbers firstNum = keyboard.nextInt(); //keyboard... ...keyboard.nextlnt() secondNum=keyboard.nextInt(); //keyboard... ...keyboard.nextlnt() System.out.println("Your numbers are : "+firstNum+" and "+secondNum); System.out.println("sum="+(firstNum+secondNum)); System.out.println("product="+(firstNum*secondNum)); } }