Advertisement
glee20

Calculator Test

Oct 4th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. import java.util.*;
  2. public class tester
  3. {
  4.     public static void main (String args []){
  5.         Scanner in = new Scanner(System.in);
  6.         double a,b;
  7.         Calculator c1 = new Calculator ();
  8.        
  9.         Calculator c2 = new Calculator ("***NLCS CALCULATOR***");
  10.        
  11.         System.out.println(c1.getName());
  12.         System.out.println("The result of 3 + 3 is "+c1.add(3,3));
  13.         System.out.println("The result of 9 + 4 + 6 is "+c1.add(9,4,6));
  14.        
  15.         System.out.println(c2.getName());
  16.         System.out.println("Enter the value of a.");
  17.         a = in.nextDouble();
  18.         System.out.println("Enter the value of b.");
  19.         b = in.nextDouble();
  20.         System.out.println("The result of " + a + " + " + b + " is "+c2.add(a,b));
  21.         System.out.println("The result of " + a + " * " + b + " is "+c2.multiply(a,b));
  22.         System.out.println("The result of " + a + " / " + b + " is "+c2.divide(a,b));
  23.         System.out.println("The result of " + a + " % " + b + " is "+c2.modulus(a,b));        
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement