You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
642 B
38 lines
642 B
import java.util.*;
|
|
public class MathProblems
|
|
{
|
|
|
|
// Implement this method, which prompts the user for a and b, then divides a by b
|
|
// and then calculates a % b. If the user enters an invalid type of input, or a
|
|
// zero for the divisor, an Exception will be thrown, both of which need to be caught
|
|
public void divide()
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
}
|
|
catch( )
|
|
{
|
|
|
|
}
|
|
catch( )
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void main( String[] args )
|
|
{
|
|
// Test it here in main, when ready
|
|
MathFunctions functions = new MathFunctions();
|
|
|
|
functions.divide();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|