Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions