Assignment #25: A Simple Calculator
Code
/// Name: Kiran O'Farrell
/// Period: 7
/// Program name: A Simple Calculator
/// File Name: SimpleCalculator.java
/// Date Finished: 9/23/15
import java.util.Scanner;
public class SimpleCalculator {
public static void main (String[] args) {
Scanner keyboard = new Scanner(System.in);
double a, b, c, answer;
System.out.print("What is your first number? ");
a = keyboard.nextDouble();
System.out.print("What is your second number? ");
b = keyboard.nextDouble();
System.out.print("What is your third number? ");
c = keyboard.nextDouble();
answer = (a + b + c) / 2.0;
System.out.println("(" + a + " + " + b + " + " + c + ") / 2 = " + answer);
}
}
Picture of the output