Select appropriate variable

Assignment Help Basic Computer Science
Reference no: EM13859797

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.

2. (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 square which inheres the above point class.
A square is described by a point which is one corner of the square and the length
of the side of the square.
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.

 

3. (TCOs 1-8) Start from the following code, and add Action Listener to make it functional. The user inputs a temperature in celsius or farenheit 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 the formula to convert farenheit to celsius:  C = 5/9(F - 32)

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(" JButton jbtRight = new JButton("=>");

JPanel panel = new JPanel(new GridLayout(2, 3));
panel.add(lblC);
panel.add(jbtLeft);
panel.add(lblF);
panel.add(jtfC);
panel.add(jbtRight);
panel.add(jtfF);

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

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

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.Graphics;
import java.awt.Color;

public class drawFlag extends
JFrame {
public
drawFlag() {
add(new
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.

Reference no: EM13859797

Questions Cloud

A hotel salesperson enters sales in a text file : A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), the amount of the sale, and the date of that event...
The traditional approach to modelling : 1. Outline the primary ways in which the traditional approach to modelling a use case differs from an object-oriented approach. Develop a scenario in which you would use the traditional approach over the object-oriented approach, and explain your rea..
Explain the various privacy rights : Explain the various privacy rights that businesses on the Web are lawfully obligated to adhere to. Describe some of the gray areas in enforcing these laws on the Internet. When we consider gray areas, think about privacy issues that companies may not..
New string and the string''s length : Copy first half and last half of the characters into two other strings. Print the two strings. Form a new string like this:  _? . (first half of the string followed by the 3 characters _,?, and then followed by second half of the string). Print this ..
Select appropriate variable : 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..
The probability of finding an electron at a point in an atom : The probability of finding an electron at a point in an atom is referred to as the probability density (). The spatial distribution of these densities can be derived from the radial wave function and angular wave function , then solving the Schrdinge..
Calcium sulfate is sparingly soluble in water : Calcium sulfate is sparingly soluble in water. describe and explain what would you see when few cm^3 of concentrated of Na2SO4 (aq) were added to a solution of CaSO4 (aq).
Calculate the percent yield of al2o3 : Assume you take a sample of 13.6 g Al and oxidize it (in an excess of O2) to produce 12.07 g of Al2O3. Calculate the percent yield of Al2O3. Reaction: 4 Al + 3 O2 → 2 Al2O3.
What concentration of sulfuric acid remains after neutraliz : 2KOH + H2SO4 --> K2SO4 + @H2O .850 L of .450 m h2so4 is mixed with .800 L of .230 M KOH. what concentration of sulfuric acid remains after neutralization

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Generate an array of 20 random integers from 0 to 9

generate an array of 20 random integers from 0 to 9. Search for the first occurrence, if any, of the number 7, and report its position in the array.

  Design a class for representing a rectangular grid

Design a class for representing a rectangular grid and use it to allow a user to query a grid interactively as part of a game.

  Write a code to perform an lu decomposition

Write a code to perform an LU decomposition of the coefficient matrix [A] (given below) using L-U decomposition with Gauss elimination. Your code should output ILl and [U] as well as verify that: [A] = [L][ U ] Use the following MATLAB matrix func..

  Information culture have negative impact on apple-s business

Which of the given information cultures would have the greatest negative impact on Apple's business? Information-functional culture, Information-sharing culture.

  Determine if the string s=s1s2...sk

Suppose we want to determine if the string s=s1s2...sk is a substring much larger string a1a2...an. One approach is to compute h(s) with some hash function h.

  The use of an external service provider for data storage

Prepare a 6-10 slide narrated PowerPoint presentation that identifies the possible risks to an organization in each of the following outsourcing situations: The use of an external service provider for your data storage.

  What is the total seek distance

(1)Suppose a linked disk allocation method is used. What is the total seek distance

  Components of an instructional strategy

we discussed the importance of planning your instructional strategy. What are the components of an instructional strategy? How important is the room layout and what impact does it have on the effectiveness of training?

  Design a modular progama

A retail company must file a monthly sales tax report listing the total sales for the month and the amount of state and county sales tax collected. Design a modular progama that asks the user to enter the total sales for the month

  Evaluation process to seven-step acquisition model

Discuss in scholarly detail the acquisition evaluation process to the Seven-Step Acquisition Model.

  Which of the following statements is true

Which of the following statements is true?

  Example of extrinsic reward - example of intrinsic reward

Give an example of intrinsic reward and an example of extrinsic reward you have met with recently. Which of those had a bigger influence on you and why?

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