Java #7: How to Intake and Add Numbers

//Programmer:Akinwale Owi
//Progranm Purpose: Ask User For Numbers and Add Them
//Company:Dagba Computers

//package name
package dagba.computers;

import java.util.Scanner;

//class name
public class DagbaComputers {

//main function
public static void main(String[] args)

//Creation of Scanner
Scanner numScanner = new Scanner (;

//Variables to save user input
double firstNum, secondNum, total;

//Ask User For First Number
System.out.println(“Please enter the first number you want me to add”);

//intake first Number
firstNum = numScanner.nextDouble();

//Print out first number, to check it saved correctly
System.out.println(“The first number is: “+firstNum);


//Ask the User For the Second Number
System.out.println(“Please enter the second number:”);

//Intake Second Number
secondNum = numScanner.nextDouble();

//Here I print out second number
System.out.println(“The second number is: “+secondNum);

//Adding the two numbers
total = firstNum + secondNum;

//printing the total
System.out.println(“The total of two numbers = “+total);

}//End of main function

}//end of DagbaComputers Class


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s