Ask the user for information to draw three circles

Assignment Help JAVA Programming
Reference no: EM132101136

Please use JAVA

Objectives

Call methods with parameters and return values.

Use the DrawingPanel and Graphics classes.

Use if statements to control return values and print statements.

Task

Ask the user for information to draw three circles in a DrawingPanel. Print information about the circles. Each item of information should correspond to a different static method.

Details

The DrawingPanel should be 400x300.

Circles

Ask the user for the center and radius of each circle. Use the fillOval method to draw the circles. Note that the parameters to fillOval (the upper-left corner and the width and height of the bounding box) need to be calculated from the information provided by the user (the center and the radius). Also, fill the circles using three different colors.

Methods

Each of the following items should be performed by a separate static method. Each method might have up to six parameters. Each circle is described by three values: the x and y values of the center, and the radius.

One static method should have parameters for the radiuses of two circles (two parameters), and the method should return -1 if the first circle is smaller, return 0 if the two circles have the same size, or return 1 if the first circle is larger. Based on the return value from this method, the main method should print a line of output like:

The green circle is smaller than the red circle. Another static method should have parameters for the radiuses and locations of two circles (six paramters), and the method should return 1 if the circles intersect or return 0 if the circles do not intersect (alternatively, you could return true or false). If (x1,y1) and (x2,y2) are the centers of the circles and if r1 and r2 are their radiuses, then the circles intersect if the distance between the centers, the square root of:

(x1 - x2)2 + (y1 - y2)2
is less than or equal to r1 + r2. Based on the return values from this method, the main method should print a line of output like:

The blue circle intersects the red circle.

(Optional) Given a circle, return 1 if the circle is completely within the window, return 0 if the circle is partially within the window, or return -1 if the circle is completely outside the window. The program should print something appropriate.

Note that each method needs to be called three times. If your circles are blue, green, and red, then the first method needs to be called for three pairs: blue and green, blue and red, and green and red.

If you find it is more convenient to return values other than -1, 0, and 1, you are free to do so. However, your methods must return values that your main method uses to print the results. You are also free to implement any additional methods that you like.

Reference no: EM132101136

Questions Cloud

Write a series of functions that convert a decimal number : Write a series of functions that convert a decimal number into binary and octal.
What do the abbreviations stand for : What do the abbreviations stand for? How does each of them work? What are the limitations for the number of devices that can be connected for each of
What is the concept of globally right source : What is the concept of Globally Right source and how can an organization use this to add value to their activities to increase their competitive positions?
Company face when creating a strategic plan : What are some of the legal issues a company face when creating a strategic plan?
Ask the user for information to draw three circles : Ask the user for information to draw three circles in a DrawingPanel. Print information about the circles.
Project vs a product from a business analyst : Whats the difference between a project vs a product from a Business Analyst's perspective and a solution vs a deliverable.
Describes the Background of Software Development Project : CC37-3 Project Management Methods & Tools Assessment (Report +Viva) Assignment, MAJAN UNIVERSITY COLLEGE, Oman. Describes the Background of selected topic
Wirte down the pseudo-code for the following program : wirte down the pseudo-code for the following program. Your pseudo-code needs to include the correct name of important APIs.
Discuss the strengths and weaknesses of the design produced : Discuss the strengths and weaknesses of the design produced and make suggestions as to how weaknesses might be addressed

Reviews

Write a Review

JAVA Programming Questions & Answers

  How to count number of objects (instances) created

How to count number of objects (instances) Created, use java code and please be descriptive

  Write the lines of code inside the main method

Write the lines of code inside the main() method to print the bibliographic entry as outlined by the flowchart in Figure 2-74.

  Java class library with thousands of predefined classes

The Java Application Programming Interface is a Java class library with thousands of predefined classes

  Consider a typical certification hierarchy

Why might Bob still not trust that the certificate for Alice truly establishes Alice as the owner of the public key in the certificate?

  Show running versions of the program

Show three running versions of the program in a single screen shot with 3 different size stop signs - Make the circle a red filled circle. Add 4 buttons below the Left-Right-Up-Down buttons with Red and any three other colours.

  Write a statement that writes both of their values

Given an interger variable i and floating-point variable f, write a statement that writes both of their values to standard output in the following format: i=value-of-i f=value-of-f.

  Write a version of sumpairs

Write a version of sumPairs  that sums each component of the pairs separately, returning a pair consisting of the sum of the first components and the sum of the second components. So basically [(3,1)(10,3)] would return (13,4).

  Developing prototype applet for web inventory management

As a lead systems developer for iDev3, you have been assigned as a consultant to work with Wrigley Inc (the gum company). Your project consists of developing a prototype applet for web-based inventory management

  Reimplement the labeledpoint class of exercise

Reimplement the LabeledPoint class of Exercise P9.12 by storing the location in a java.awt.Point object. Your toString method should invoke the toString method of the Point class.

  Displays a list of all customers showing the customer

Write a query that displays a list of all customers showing the customer first name, last name, and phone number.

  Requirements for java snake game

Requirements for java Snake Game - all 3 options (with 3 choices each) are working and have some influence on how the game is played.

  Implementation of encryption and steganography in java

This is a project report showing the essential details and coding structures related with the implementation of encryption techniques and steganography in JAVA.

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