Java Reference
In-Depth Information
12.
Correct the syntax errors in the following program and add any additional
statements necessary to make the program work:
import
javax.jswing.*;
public class
ROne
extends
JFrame
{
static private final int
WIDTH = 400;
static private final int
HEIGHT = 300;
public
RectangleProgramOne()
{
setTitle("Welcome");
setSize(WIDTH,HEIGHT);
SetVisible(
true
);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void
main(String args[])
{
ROne r1 = r1();
}
}
13.
Correct the syntax errors in the following program:
public class
RTwo
extends
JFrame
{
public
RTwoProgram()
{
private
JLabel length, width, area;
setTitle("Good day Area");
length = JLabel("Enter the length);
width = JLabel("Enter the width);
area = JLabel("Area: ");
containerPane = ContentPane();
pane.setLayout(GridLayout(4,1));
setSize(WIDTH,HEIGHT);
setVisible();
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void
main(String args[])
{
RTwoProgram R2 =
new
RTwoProgram();
}
}
14.
Consider a common DVD player. What are the methods of a DVD player?
15.
What are the methods of an ATM?
16.
Do an OOD analysis of the following problem: Write a program to input the
dimensions of a cylinder, and calculate and print the surface area and volume.
Search WWH ::
Custom Search