• 100% Satisfaction Guarantee
Category: Homework
Satisfied Customers: 3040
Experience:  MIT Graduate (Math, Programming, Science, and Music)
3546829
Scott is online now

# Question 1. 1. (TCOs 1–8) Write a class called pointfor the

### Customer Question

Question 1. 1. (TCOs 1–8) Write a class called point
for the 2-D environment with attributes for the x and y coordinates.
Select appropriate variable(s).
Write constructors.
Write access methods for the variables.
Write a Print method to display the variables when called.
Write a test program to test it. (Points : 20)
Question 2. 2. (TCOs 1–8) Write a class called circle,
which inheres the above point class. It is represented by a point which is the center of the circle and the radius.
Select appropriate variable(s).
Write constructors.
Write access methods for the variables.
Override the inherited Print method to display variable in circle and point.
Write a test program to test it. (Points : 20)
Question 3. 3. (TCOs 1–8) Start from the following code, and add Action Listener to make it functional to do the temperature conversion in the direction of the arrow that is clicked. (Need about 10 lines)
Note:
import javax.swing.*;
import
java.awt.GridLayout;
import
java.awt.event.*;
import
java.text.DecimalFormat;
public class temperatureConverter extends JFrame {
public static void
main(String[] args) {
JFrame frame = new temperatureConverter();
frame.setTitle("Temp");
frame.setSize(200, 100);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public
temperatureConverter() {
JLabel lblC = new
JLabel("C",SwingConstants.CENTER);
JLabel lblF = new
JLabel("F",SwingConstants.CENTER);
final
JTextField jtfC = new JTextField();
final
JTextField jtfF = new JTextField();
JButton jbtLeft = new JButton("");
JPanel panel = new JPanel(new GridLayout(2, 3));
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 a dozen lines)
import javax.swing.*;
import
java.awt.Graphics;
import java.awt.Color;
public class drawFlag extends
JFrame {
public
drawFlag() {
NewPanel());
}
public static void
main(String[] args) {
drawFlag frame = new drawFlag();
frame.setTitle("Flag");
frame.setSize(200, 200);
frame.setLocationRelativeTo(null); // Center the frame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
The post tip is a solid circle coordinate and size is (68, 28, 4, 4).
The flag tip is a rectangle with coordinate and size is (70, 30, 50, 30).
The text coordinate is (85, 118).
The starting and ending coordinate for the post is (70, 30, 70, 120).
Color blue with text black. (Points : 20)
Submitted: 2 years ago.
Category: Homework
Customer: replied 2 years ago.
java logic pro
Expert:  LogicPro replied 2 years ago.