Write a single statement to declare a circle object

Assignment Help Computer Engineering
Reference no: EM131985166

Assignment

Question1: Write code that would go inside of a handler in a GUI program.

allow the user to type a number into a text field

double the number and display the output to the user

once the display is updated, the user should not be able to enter another number

You do not have to account for the user entering non-numeric input.

Use the following variables:

JTextField numberInputField

JLabel resultOutputLabel

Your code would go here:

public class NumberInputFieldListener implements ActionListener {

public void actionPerformed(ActionEvent e) {

// YOUR CODE HERE

}

}

Question 2: Use the following code for the next three questions. Assume there is also a Square class (not shown here).

public class Circle{

private int diameter;

public Circle(int d) {

diameter = d;

}

public double getArea() {

return Math.PI * Math.pow( (diameter / 2), 2);

}

public static boolean squareFitsInCircle(Circle circle, Square square) {

return square.getArea() <= circle.getArea();

}

}

Question

Write a single statement to declare and instantiate a Circle object called myCircle that has a diameter of 2.

Question

Write a single statement to print to the console the area of the circle you created above.

Question

You are given a Square object called mySquare.

What a single statement to that would go in a separate class (like a driver program) to determine whether mySquare can fit inside of myCircle. Store the result in a variable called canFit.

Reference no: EM131985166

Questions Cloud

Clients that are not organic in nature : According to Freud, what actually is unconsciousness and how does it relate to symptoms exhibited by clients that are not organic in nature (medically explained
What can you say about the relationships of given classes : Look at code below. You have four classes (O, X, T, and M). What can you say about the relationships of these classes? Draw a class diagram.
Briefly discuss a core principle of deontology : Briefly discuss a core principle of deontology, then consider whether utilitarianism or deontology is best suited to examine questions about the morality
What is the typical etiology for the emergency : What is the typical etiology for the emergency of dissociative identity disorder and what are some of the common symptom characteristics?
Write a single statement to declare a circle object : Write a single statement to declare and instantiate a Circle object called myCircle that has a diameter of 2. Write a single statement to print to the console.
Heterosexual development and homosexual development : How does sexuality develop and are there any differences between heterosexual development and homosexual development
Collaboration lighten the load for inclusion teachers : How does increased collaboration lighten the load for inclusion teachers? what practical strategies can be use to increase collaboration schools
Teachers or administrators make educational decisions : Why do you think it is illegal and unethical to have special education teachers or administrators make educational decisions for the special needs student alone
Why is it important to have a variety of stakeholders : Why is it important to have a variety of stakeholders involved in IEP meetings and placement decisions for students with disabilities?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Plan and implement a class called statistician in c++

build and implement a class called statistician in C++. After a statistician is initialized, it can be given a sequence of double numbers. Each number in the sequence is given to the statistician by activating a member function called next_number.

  How can applied to real world software development process

List four types of systems tests explaining the two question belo-w how they can be applied to real world software development process?

  Developing the lan network for a company

You have been asked to develop a LAN with operation over the distance of around 100m. Compare and contrast the twisted pair cable, fiber-optics, and wireless for this application.

  Demonstrate that both the ff and bf heuristics

Demonstrate that both the FF and BF heuristics for the 1-BP problem take O(m log m) steps.

  Write an application that computes the area of a circle

Write an application that computes the area of a circle, rectangle, and cylinder. Display a menu showing the three options.

  Implement a programme that reads an integer value

Design and implement a programme that reads an integer value and prints the sum of all even integers between 1 and the input value inclusive, as well as the sum of all odd integers.

  Advantages and disadvantages of cloud computing

Examine the major advantages and disadvantages of cloud computing for the two (2) selected organizations. Recommend whether or not each of the selected companies should use cloud computing. Provide a rationale for your response

  What is not working properly since you can get to a site

What isn't working properly, since you can get to a site via the Internet but can't get the domain name CNN to be recognized?

  Give a formula for the total amount of memory devoted

The cache block size is c bytes. Give a formula for the total amount of memory devoted to directories (excluding the two state bits per directory entry).

  Describe where sequential file processing might be used

Develop an case to illustrate your definition. (The example does not have to be as elaborate. Just a record with a simple explanation)

  Compute the variance of the prediction error

Encode this with a DPCM system with a 3-bit Gaussian nonuniform quantizer and a first-, second-, third-, fourth-, and fifth-order predictor.

  Describe how are the topics of the two articles related

Prepare a brief synthesis and summary of the two articles. Describe How are the topics of the two articles related? What information was relevant 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