A+ Answers



QUESTION 1.. (TCOs 1–8) NOTE:  YOU DO NOT have to compile/run this code in eclipse.  You are writing the code here only.
Write a class called point
that has attributes and methods to model an (x,y) coordinate in a 2-D environment.
Select appropriate variable(s).
Write a default and parameterized constructor.
Write set and get methods for the variables.
Write a Print method to display the variables when called.
Write a test program to test the methods. (Points : 20)
QUESTION 2. 
Write a class called circle which inherits from the above point class.
A circle consists of a point which is the center of the circle and a radius.
Select appropriate class variable(s).
Write constructors.
Write set and get 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. (TCOs 1–8) Start from the following code, and add Action Listener to make it functional.  The user inputs a weight in pounds or kilograms in the appropriate textbox, then clicking the arrow will convert and display the result.  (Note ONLY code the ACTION LISTENER, you should only need about 10 lines of code)
Note: 1 lb = .0.453592 kg.
import javax.swing.*;
import
java.awt.GridLayout;
import
java.awt.event.*;
import
java.text.DecimalFormat;
QUESTION 4.
(TCOs 1–8) Start from the given class, and create a NewPanel class to draw a figure like below: YOU DO NOT have to compile/run this code in eclipse.  You are writing the code here only.  Need about 15 lines of code.
import javax.swing.*;
import java.awt.Color;
import
java.awt.Graphics;