Witshaper is the Professional (Computing Skills, English Learning and Soft Skills) Skill Development Training Center. We provide Professional IT Courses and Soft Skill Training in Dehradun to Students, Employees and organization. Who wish to pursue a career in IT Technology. Witshaper is led by a motivated team of IT experts and Soft Skill Professionals. We provide high quality trainings. Our Emphasis is on giving the practical knowledge to the students, so that they will get to know in depth and never forget what they opt, we provide to the students real learning environment. Witshaper prepares students and professionals to be the part of this growing industry. Be a part of Witshaper and get your dreams successful

Wednesday, 20 May 2015

A java class which throws an exception if operand is nonnumeric in calculating modules

import java.io.*;
import java.util.*;
class Numb
{
 public static void main(String args[])
 {
   int i,j;
float add,sub,mul,div;
System.out.println("CALCULATOR:");
System.out.println("Enter two Operands:");
Scanner in=new Scanner(System.in);
try
{
i=in.nextInt();
j=in.nextInt();
add=i+j;
sub=i-j;
mul=i*j;
div=i/j;
System.out.println("Addition ="+add);
System.out.println("Subtraction ="+sub);
System.out.println("Multiplication ="+mul);
System.out.println("Division ="+div);
}

catch(InputMismatchException e)
{
System.out.println("Program Is Terminated Exception Caught");
}

}
}

1 comment: