//******************************************************************** // lab14.java Author: Brenneman // // Driver for a some experimentation with methods and parameter passing. // Uses the Multiplier class, which has methods for multiplying different data types. //******************************************************************** import cs1.Keyboard; public class lab14 { //----------------------------------------------------------------- // Calls different multiply methods in the Multiplier class. //----------------------------------------------------------------- public static void main (String[] args) { Multiplier trythis = new Multiplier(); //------ gets an int from the user and sends it to multiply System.out.print("Please enter an integer: "); int number = Keyboard.readInt(); System.out.println("\nBefore the call to multiply, int number is: " + number); trythis.multiply(number); System.out.println("\nAfter the call to multiply, int number is: " + number); System.out.println("----------------------------------------------\n"); //------ gets a double from the user and sends it to multiply System.out.print("\nPlease enter a decimal number: "); double floatnum = Keyboard.readDouble(); System.out.println("\nBefore the call to multiply, floatnum is: " + floatnum); // REMOVE THIS COMMENT AFTER YOU HAVE WRITTEN THE METHOD TO MULTIPLY doubles // trythis.multiply(floatnum); System.out.println("\nAfter the call to multiply, floatnum is: " + floatnum); System.out.println("----------------------------------------------\n"); //------ gets an integer from the user, //------ instantiates a Num object with that integer as its initial value, //------ and sends it to multiply System.out.print("Please enter an integer: "); number = Keyboard.readInt(); Num numobj = new Num(number); System.out.println("\nBefore the call to multiply, numobj is: " + numobj); // REMOVE THIS COMMENT AFTER YOU HAVE WRITTEN THE METHOD TO MULTIPLY Num objects // trythis.multiply(numobj); System.out.println("\nAfter the call to multiply, numobj is: " + numobj); System.out.println("----------------------------------------------\n"); } }