Free Essay

Cs 520,Cs/520,Cs520

In:

Submitted By ashhad
Words 251
Pages 2
HELPIDO.COM

FOLLOW THIS LINK TO GET THE TUTORIAL

---------------------------------------------------- http://helpido.com/category/cs-520/ ----------------------------------------------------

Create a package named cs520.hw3.part1. Using this package, create a class named BullsEye extending the JFrame class with the following specifications:
a. Declare the integer type instance variables centerX, centerY, outermostRadius, and ringWidth. The first two values represent the center of the bulls eye, the third value represents the radius of the outermost circle, and the last value is the width of each ring.
b. In the constructor, specify the appropriate window title using your lastName and assign the above instance variables with the values 150, 150, 100, and 12, respectively. Note that the ring width is different in this homework.
c. In the paint method,
a. Declare a variable named currentRadius and assign the outermostRadius to it.
b. Declare an integer counter variable and initialize it with the value 0.
c. Using a while construct, repeat the following steps as long as the currentRadius variable has a positive value.
• If the counter is even valued, set the current color to blue. Otherwise, set the current color to pink.
• Fill a circle using the specified center coordinates and the current radius value.
• Decrement the current radius by the ring width.
• Increment the counter.
In the main method, create the application object, set its size to 300 by 300 and its visibility to true to test the above graphics

HELPIDO.COM

FOLLOW THIS LINK TO GET THE TUTORIAL

---------------------------------------------------- http://helpido.com/category/cs-520/ ----------------------------------------------------

Similar Documents

Free Essay

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- Java-CS520-HW 3-part1 Create a package named cs520.hw3.part1. Using this package, create a class named BullsEye extending the JFrame class with the following specifications: a. Declare the integer type instance variables centerX, centerY, outermostRadius, and ringWidth. The first two values represent the center of the bulls eye, the third value represents the radius of the outermost circle, and the last value is the width of each ring. b. In the constructor, specify the appropriate window title using your lastName and assign the above instance variables with the values 150, 150, 100, and 12, respectively. Note that the ring width is different in this homework. c. In the paint method, a. Declare a variable named currentRadius and assign the outermostRadius to it. b. Declare an integer counter variable and initialize it with the value 0. c. Using a while construct, repeat the following steps as long as the currentRadius variable has a positive value. • If the counter is even valued, set the current color to blue. Otherwise, set the current color to pink. • Fill a circle using the specified center coordinates and the current radius value. • Decrement the current radius by the ring width. • Increment the counter. In the main method, create the application...

Words: 256 - Pages: 2

Premium Essay

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS 520 Week 2 assignment You are strongly encouraged to add comments throughout the program. Doing so will help your facilitator to understand your programming logic and grade you more accurately. You must work on your assignments individually. You are not allowed to copy the answers from the others. However, you are encouraged to discuss approaches to the homework assignment with your section mates and the facilitator in your section via the discussion board. Each assignment has a strict deadline. However, you are still allowed to submit your assignment within 2 days after the deadline with a penalty. 15% of the credit will be deducted unless you made previous arrangements with your facilitator and professor. Assignments submitted 2 days after the deadline will not be graded. The assignment solution will be available 48 hours after the assignment deadline. When the term lastName is referenced in an assignment, please replace it with your last name. You are strongly encouraged to add comments into your program! Create a new Java Project in Eclipse named HW2_lastName. Create a package named cs520.hw2 and complete the following three parts by writing the appropriate classes under this package. Part 1 (30 Points) Suppose a company’s...

Words: 474 - Pages: 2

Free Essay

Cs 520,Cs/520,Cs520

...CS 520 Week 3 assignment pART 1 Create a new Java Project in Eclipse named HW3 and complete the following two parts.Part 1 – Repetition ConstructCreate a Swing GUI application, which displays the following graphics by modifying the last week’s assignment, and using the loop constructs (for or while) as described below.Create a package named hw3.part1. Using this package, create a class named RedAndBlackSteps extending the JFrame class with the following specifications: Declare the integer type instance variables startX, startY, brickWidth, brickHeight, and brickSpace. The first two values represent the top-left coordinates of the red brick in the first row. The next two values are the width and height of each brick. The last value represents the space between each brick along any direction. Declare another integer instance variable, numberOfRows, representing the number of rows desired for the pattern. In the constructor, specify the appropriate window title using your lastName and assign the instance variables in step a) with the values 400, 50, 50, 30, and 2, respectively. In the constructor, initialize the numberOfRows with the value 5. In the paint method, declare two local variables named currentX and currentY. Assign the startX and startY variables to these local variables, respectively. Using nested loops, draw the pattern for the desired numberOfRows. Note that the pattern should work for other values as well...

Words: 281 - Pages: 2

Free Essay

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS 520 Week 3 assignment pART 2 Create a new Java Project in Eclipse named HW3 and complete the following two parts.Part 2 – InheritanceCreate a package named hw3.part2. Using this package, create the following classes and implement the specified functionality. Create a class named Employee as follows. The instance (or member) private variables – name (String) and wageRate (integer). The wageRate denotes the weekly wages (@40 hours/week) for this employee. A single constructor with two arguments, the name and the wage rate. Set the instance variables with the specified argument values. The public set and get methods for the two instance variables. A public computePayStub method which takes a double argument, named hours, and returns a double showing the weekly wages for this employee. The employee is only paid for a maximum of 40 hours for the week based on the weekly wageRate. If this employee worked less than 40 hours, the wages are prorated accordingly. Override the toString method to return the string representation of this object in the format “Employee:@$/week”. No instance variables are allowed in the Consultant class. A single constructor with two arguments, the name and the wage...

Words: 455 - Pages: 2