Write a class called point for the two-d environment

Assignment Help JAVA Programming
Reference no: EM131103002

1. Write a class called point for the 2-D environment.

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.

2. Write a class called circle, which inheres the above point class.

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.

3. Start from the following code, and add Action Listener to make it functional. (Need about 10 lines)

Note: 1 lb = .0.453592 kg.

import javax.swing.*;

import

java.awt.GridLayout;

import

java.awt.event.*;

import

java.text.DecimalFormat;

public class weightConverter extends JFrame {

public static void

main(String[] args) {

JFrame frame = new weightConverter();

frame.setTitle("Weight");

frame.setSize(200, 100);

frame.setLocationRelativeTo(null);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);

}

 

public

weightConverter() {

JLabel lbllb = new JLabel("lb",SwingConstants.CENTER);

JLabel lblkg = new JLabel("kg",SwingConstants.CENTER);

final

JTextField jtflb = new JTextField();

final

JTextField jtfkg = new JTextField();

JButton jbtLeft = new JButton("<=");

JButton jbtRight = new JButton("=>");

JPanel panel = new JPanel(new GridLayout(2, 3));

panel.add(lbllb);

panel.add(jbtLeft);

panel.add(lblkg);

panel.add(jtflb);

panel.add(jbtRight);

panel.add(jtfkg);

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

final

DecimalFormat dec = new DecimalFormat("#.00");

}

}

4. 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.

Reference no: EM131103002

Questions Cloud

Phases in the systems development life cycle : List and describe the seven phases in the systems development life cycle and determine which phase is most important to an individual developing an app for your favorite mobile device.
How processes and mission drive behavior : Address the deeper currents of culture as well as how processes and mission drive behavior, and place in this organization (from which perspective are writing), not merely from a "job description" perspective, but from at the individual and group ..
Theories of situational leadership : Describe the three theories of situational leadership and what you consider to be the strengths and weaknesses of each theory when leading staff in the organizational environment.
Are these materials appropriate for their intended audiences : Write an essay of approximately 500 words that answers the following questions: What qualities or characteristics of these materials make them effective or ineffective? Are these materials appropriate for their intended audiences?
Write a class called point for the two-d environment : Write a class called point for the 2-D environment. Start from the following code, and add Action Listener to make it functional. Write a class called circle, which inheres the above point class.
Legislation regarding legalizing anti-lgbt measures : As some of you may be circumspect, several states have introduced or pass legislation regarding legalizing anti-LGBT measures. Several states have proposed legislation roughly delineated as "bathroom bills,"
Use the lessons learned in your bba program : Discuss how you will use the lessons learned in your BBA program to be more productive in your current (or future) career. Provide specific examples to support your response.
Explain the proper value of the securities being offered : an investor might pay too much for some new stock and consequently lose heavily. Do you think the SEC should, as a part of every new stock or bond offering, render an opinion to investors on the proper value of the securities being offered? Explain.
Why is it a good idea to use a manager as a trainer : Susan has to decide which of her employees can go on vacation during certain times of the year. Which of the following decision roles of a manager is Susan using?

Reviews

Write a Review

JAVA Programming Questions & Answers

  How can an applet get information about the url

How can an applet get information about the URL it was called from? What is an applet? What API changes are there for applets with JDK 1.4?

  Java application that calculates the body mass index

Write a Java application that calculates and displays the body mass index (BMI) for N people

  Write a test program that creates 2 shopping carts

Test the program and provide a list of comprehensive test cases used to validate the application and include these test cases in a word document containing all UML diagrams and descriptions. The test data can be shown in a table that includes inpu..

  Number of primes

Write a program BackwardPrimes.java that prompts user for a positive integer number x and displays x prime numbers whose reversal is also a prime. Numbers 13, 31 and 157 are instances of such numbers. Following is a sample run of your program.

  Writing a java program that provides simple statistics

You will be writing a Java program that provides simple statistics about the input data. The method stubs are given below. This assignment will give you experience with methods

  Determine the length of the string

You must give your user three opportunities for wrong input before you terminate the program.

  Assignment on java applets and activex controls

Go online and search for information about security threats posed by Java applets and ActiveX controls. Note that most of these programs are small in size and downloaded onto computers over the Internet.

  Create a non-gui based java application

Create a non-GUI based Java application that calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee.

  Your project as a programming consultant is to create a

your project as a programming consultant is to create a program that develops an amortization schedule.nbsp your

  Write an application class that contains several methods

Write a driver class. This class should use the main method to call four methods in the application class that will display our JOptionPanes - Write an application class that contains several methods.

  Develop one application using jtabbedpanes and jframes

Develop one application using JTabbedPanes and JFrames and another application that connects to a MySQL database.

  Define javascript and servlet

The web site must be built using one of these techniques. JavaScript and servlet

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd