/*** * Dummy program for demonstrating a running time error: * Forget to protect it from dividing a number by 0 * */ import java.math.*; //A simple program that Does percentage operations public class MathOperation { static double pminus (double x, double y){ return (x-y)*100; } static double pplus (double x, double y){ return (x+y)*100; } static double pmultiply(double x, double y){ return x*y*100; } static double pdivide(double x, double y){ return 100*x / (y*1.0); } public static void main(String[] args) { double a = MathOperation.pplus(0.4, 0.5); double b = MathOperation.pminus(a, 90.00); double c= MathOperation.pdivide(100, b); System.out.println("c=" +c + "%\n"); } }