Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) if a method does not declare throwing a RuntimeException, can itthrow a Runti

ID: 3619259 • Letter: 1

Question

1) if a method does not declare throwing a RuntimeException, can itthrow a RuntimeException, or a subclass of RuntimeException??

2) Write a Java applet to add two numbers from text fields, anddisplays the result in a non-editable text field. Enable yourapplet to run standalone with a main method. Be very brief andsimple. I need to see the GUI and the implementation code, i.e.ActionPerformed method.

any help on this??? cant find a way to do these 2 problems..

i want to become a premium member for cramster but i would like totest this site for today and if everything goes fine than i willbuy the membership tom...

thanks for all your help..



Explanation / Answer

1) if a method does notdeclare throwing a RuntimeException, can it throw aRuntimeException, or a subclass of RuntimeException?? Yes 2) Write a Java applet to add two numbers from text fields, anddisplays the result in a non-editable text field. Enable yourapplet to run standalone with a main method. Be very brief andsimple. I need to see the GUI and the implementation code, i.e.ActionPerformed method. importjavax.swing.*; import java.awt.event.*; import java.awt.*; public class Add extendsJApplet { privateJTextField num1, num2, sum; publicvoid init() { num1 = new JTextField(5); num2 = new JTextField(5); sum = new JTextField(7); JPanel p =new JPanel(); p.setLayout(new BorderLayout()); p.add(num1,BorderLayout.WEST); p.add(new JLabel("+"),BorderLayout.CENTER); p.add(num2,BorderLayout.EAST); p.add(sum,BorderLayout.SOUTH); ActionListener action = new ActionListener() { public void actionPerformed(ActionEvent e) {    sum.setText(""+(Double.parseDouble(num1.getText())+Double.parseDouble(num2.getText()))); } }; num1.addActionListener(action); num2.addActionListener(action); sum.setEditable(false); add(p); setSize(150, 40); } }