Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Type the below source inside task1.java. and run the program that reads two integers, calculates the sum of the numbers and displays the output Notes:

Type the below source inside task1.java. and run the program that reads two integers, calculates the sum of the numbers and displays the output

Notes: Dont forget to input the two data in advance inside the input console.

import java.util.Scanner;

public class FirstProgram {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

System.out.println ("Hello out there.");

System.out.println ("I will add two numbers for you.");

System.out.println ("Enter two whole numbers on a line:");

double n1, n2;

Scanner keyboard = new Scanner (System.in);

n1 = keyboard.nextInt ();

n2 = keyboard.nextInt ();

System.out.println ("The sum of those two numbers is");

System.out.println (n1 + n2);

}

}

Here is a sample run that will show in the Output Window below Source editing window.

Outputs

Hello out there.

I will add two numbers for you.

Enter two whole numbers on a line:

The sum of those two numbers is

4.0

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

13. You always should try to make a good first impression.

Answered: 1 week ago