Package ca.maldahleh.JavaCalculator

Source Code of ca.maldahleh.JavaCalculator.Subtraction

/*
* This file is part of Java Calculator.
*
*  Java Calculator is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
* Java Calculator is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*   along with Java Calculator.  If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2014  Mohammed Al-Dahleh
*/

package ca.maldahleh.JavaCalculator;

import java.util.Scanner;

/**
*
* @author Mohammed
*/
public class Subtraction {
   
    static void Subtraction(){
       Scanner numberReciever = new Scanner(System.in);
       double num1, num2, answer;
      
       System.out.println("Calculator> Number 2 is subtracted from Number 1.");
       System.out.println("Calculator> Enter your first number: ");
       num1 = numberReciever.nextDouble();
   
       System.out.println("Calculator> Enter your second number: ");
       num2 = numberReciever.nextDouble();
   
       answer = num1 - num2;
       System.out.println("Calculator> The answer is " + answer);
       System.out.println("Calculator> Thank you for using the calculator! More coming soon.");
       System.out.println("Calculator> This program ran for " + System.currentTimeMillis() + " miliseconds.");
      
    }
   
}
TOP

Related Classes of ca.maldahleh.JavaCalculator.Subtraction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.