Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Question 2.2. (TCOs 1-8) Write a class called square,
which inheres the above point class.

Question 2.2. (TCOs 1-8) Write a class called square,<br< h1=””>

/>which inheres the above point class.
Select appropriate variable(s).
Write constructors.
Write access methods for the variables.
Override the inherited print method to display variable in square and point.
Write a test program to test it. (Points : 20)

</br<>

Question 3.3. (TCOs 1-8) Start from the following code, and add Action Listener to make it functional. (Need about 10 lines)
Note: 1 inch = .2.54 cm.

import javax.swing.*;
import
java.awt.GridLayout;
import
java.awt.event.*;
import
java.text.DecimalFormat;

public class lengthConverter extends JFrame {
public static void
main(String[] args) {
JFrame frame = new lengthConverter();
frame.setTitle(“Length”);
frame.setSize(200, 100);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}

public
lengthConverter() {
JLabel lblin = new JLabel(“inch”,SwingConstants.CENTER);
JLabel lblcm = new JLabel(“cm”,SwingConstants.CENTER);
final
JTextField jtfin = new JTextField();
final
JTextField jtfcm = new JTextField();
JButton jbtLeft = new JButton(“<=”);
JButton jbtRight = new JButton(“=>”);

JPanel panel = new JPanel(new GridLayout(2, 3));
panel.add(lblin);
panel.add(jbtLeft);
panel.add(lblcm);
panel.add(jtfin);
panel.add(jbtRight);
panel.add(jtfcm);

this.add(panel); // Add panel to the frame

final
DecimalFormat dec = new DecimalFormat(“#.00”);
}
}

(Points : 20)

Question 4.4. (TCOs 1-8) Start from the given class, and create a NewPanel class to draw a figure like below: (Need about 15 lines)

import javax.swing.*;

import java.awt.Color;

import

java.awt.Graphics;

public class drawSun extends

JFrame {

public

drawSun() {

add(new

NewPanel());

}

public static void

main(String[] args) {

drawSun frame = new drawSun();

frame.setTitle(“Sun”);

frame.setSize(200, 200);

frame.setLocationRelativeTo(null); // Center the frame

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);

}

}

The circle coordinate and size is (70, 60, 40, 40)

The text coordinate is: (80, 85)

The starting and ending lines coordinate are

(120, 80, 134, 80)

(110, 60, 120, 50)

(90, 36, 90, 50)

(60, 50, 70, 60)

(46, 80, 60, 80)

(60, 110, 70, 100)

(90, 110, 90, 124)

(110, 100, 120, 110).

Color orange, with text color red. (Points : 20)

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"