Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Suppose you have to write a small Java program that catches exceptions with super classes. You are required to use inheritance to create an exception superclass (called ExceptionA) and exception subclasses ExceptionB and ExceptionC; where ExceptionB inherits from ExceptionA and ExceptionC inherits from ExceptionB. Your program must demonstrate that the catch block for type ExceptionA catches exceptions of types ExceptionB and ExceptionC.

Hint: You can use Arithmetic exception like divide by 0 or any similar one.
NOTE: You are required to use Graphical User Input (GUI) to show output on the screen.

Views: 18305


Replies to This Discussion

Not complete and it has been copied from stackoverflow. If anyone copy this, you will get zero marks.


      buddy it is not copy paste if u make it so u should not be here to take paste from here.

      enjoy copy paste 

mere se tu software b install nai ho ra m kia krn?

koi help kary

kia help chaye ap ko 

cs506 ka code run mtlb all procedure bta skty, plzzz

 shahzab khan

thanks to all folks!

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class SmallCalcApp implements ActionListener{
JFrame frame;
JLabel firstOperand, secondOperand, answer;
JTextField op1, op2, ans;
JButton mul;
// setting layout
public void initGUI ( ) {
frame = new JFrame();
firstOperand = new JLabel("First Operand");
secondOperand = new JLabel("Second Operand");
answer = new JLabel("Answer");
op1 = new JTextField (15);
op2 = new JTextField (15);
ans = new JTextField (15);

mul = new JButton("/");
mul.setPreferredSize(new Dimension(160,30));
Container cont = frame.getContentPane();
cont.setLayout(new FlowLayout());


frame.setSize(200, 240);
public SmallCalcApp ( ) {
public void actionPerformed(ActionEvent event) {
String oper, result;
int num1, num2, res;
/* All the information regarding an event is contained
inside the event object. Here we are calling the
getSource() method on the event object to figure out
the button that has generated that event. */

oper = op1.getText();
num1 = Integer.parseInt(oper);
oper = op2.getText();
num2 = Integer.parseInt (oper);
res = num1/num2;
result = res+"";
catch(IOException IOex) {

public static void main(String args[]) {
SmallCalcApp scApp = new SmallCalcApp();
}// end class

CS506 Assignment Solution File..!!


no code for Arithmetic exception like divide by 0

in ur submitted file.


guys error a rha he ??????

tariq  bhai this is not right solution


Looking For Something? Search Below

Latest Activity

VIP Member Badge & Others

How to Get This Badge at Your Profile DP


Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service