Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91520558
  • Price:- $20

Guranteed 24 Hours Delivery, In Price:- $20

Have any Question?


Related Questions in Computer Engineering

The population mean weight of product x is 100 pounds of

The population mean Weight Of product X Is 100 pounds of the population standard deviation is 10 pounds. Assuming the population is normally distributed, what is the Probability of obtaining a sample of 25 units of produ ...

Given an undirected graph with both positive and negative

Given an undirected graph with both positive and negative edge weights, design an algorithm to find a maximum spanning forest with the largest total edge weights.

The chancellor of a university has commissioned a team to

The Chancellor of a university has commissioned a team to collect data on students' GPAs (M = 3.0; SD = 0.5) and the amount of time they spend bar hopping every week (measured in minutes: M = 720; SD = 240). They find a ...

Question critical infrastructures -1discuss cybersecurity

Question: Critical Infrastructures - 1. Discuss cybersecurity policy issues affecting SCADA and ICS systems for Critical Infrastructure services for the public, and compare those issues to the policy issues that affect t ...

Question purpose to assess your ability tobulldiscuss

Question: Purpose: To assess your ability to: • Discuss terminology, concepts, and procedures related to database management systems. Action Items: • Write your response to 2 of the following discussion topics and post y ...

Regarding sorting lists an algorithm such as quicksort was

Regarding sorting lists, an algorithm such as QuickSort was preferred if the list was, for the most part, in random order, and that an algorithm such as Insertion Sort was preferred if the list was essentially in order. ...

Describe a ping of death attack as an attack that causes

Describe a ping of death attack as an attack that causes the victim computer to freeze and malfunction.

What is the binary representation of the decimal number

What is the binary representation of the decimal number 4.875 assuming the IEE 754 single precision format?

Suppose the government raises taxes by 100 billion assume

Suppose the government raises taxes by $100 billion. Assume that the marginal propensity to consume out new income is 0.8(i.e if a person receives $100, he will spend $80 and save $20). Consider what happens to the follo ...

Suppose you are given an undirected graph g with weighted

Suppose you are given an undirected graph G with weighted edges and a minimum spanning tree T of G. • Design an algorithm to update the minimum spanning tree when the weight of a single edge e is increased. • Design an a ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As