Assignemnt #25 A Dumb Calculator
Code
Name: Iaroslav Titov
Period: 7
Project Name: DumbCalculator
File Name: DumbCalculator.java
Date: 9/22/2015
import java.util.Scanner;
import java.util.InputMismatchException;
public class DumbCalculator
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
float n1,n2,n3;
try
{
System.out.println();
System.out.print("Enter your first number ");
n1 = keyboard.nextFloat();
System.out.println();
System.out.print("Enter your second number ");
n2 = keyboard.nextFloat();
System.out.println();
System.out.print("Enter your third number ");
n3 = keyboard.nextFloat();
System.out.println();
System.out.print("Here are your calculations: ("+n1+" + "+n2+" + "+n3+" ) / 2 = "+( (n1+n2+n3)/2 ) );
System.out.println("");
System.out.println("Thank you for using our products.");
System.out.println("© Dumb Industries");
// It sucks that shell does not display special symbols((((
}
catch (InputMismatchException e)
{
System.out.println( "WRONG INPUT!!!" );
}
}
}
Picture of the output