Question: (1) Prompt the user to input one integer and one real number and output these two numbers. (2 pts) Enter an integer: 14 Enter a

(1) Prompt the user to input one integer and one real number and output these two numbers. (2 pts)

Enter an integer: 14 Enter a real number: 11.28 The inputs are: 14 and 11.28 

(2) Convert the real number to integer and output the integer (2 pts)

11.25 to integer is: 11 

(2) Perform division and modulus on these two integers and output the result (3 pts)

14 / 11 = 1 14 % 11 = 3 

(3) Find the average of these two integers (3 pts)

average of 14 and 11 is 12.5 

ive started it

import java.util.Scanner;

public class Main { public static void main(String[] args) { // declare variables int integerNum; double integerNum2;

//prompt for input Scanner scnr = new Scanner(System.in); System.out.println("Enter an integer: "); integerNum = scnr.nextInt(); System.out.println("Enter a real number: "); integerNum2 = scnr.nextDouble(); System.out.print("The inputs are: "); System.out.print(integerNum + " and " + integerNum2); //cast double to integer and output //Perform / and % and output the result

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!