Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 399 Weeks Ago, 1 Day Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 27 Aug 2017 My Price 12.00

SquaredCircles

Write a program named SquaredCircles.java that draws the figure shown below.
Submit your SquaredCircles.java to Canvas, you do not need to submit DrawingPanel.

The DrawingPanelA????1s size is 400 A????1 400 pixels and its background color is cyan. It contains four figures of concentric
yellow circles with black outlines, all surrounded by a green rectangle with a black outline. The four figures on your
DrawingPanel should have the properties shown in the table below.

Description (x,y) position Size of subfigures Number of circles Number of rows/cols
Top left (0, 0) 100 A????1 100 5 1 A????1 1
Bottom left (10, 120) 24 A????1 24 4 5 A????1 5
Top right (150, 20) 40 A????1 40 5 6 A????1 6
Bottom right (130, 275) 36 A????1 36 3 3 A????1 3

import java.awt.*;

public class SquaredCirclesStarter {
  
public static void main( String[] args ) {
DrawingPanel panel = new DrawingPanel(400, 400);
Graphics g = panel.getGraphics();
  
panel.setBackground( Color.CYAN );
  
drawCircles( g, 0, 0, 100, 5 );
drawCircles( g, 10, 120, 24, 4);
drawCircles( g, 150, 20, 40, 5);
drawCircles( g, 130, 275, 36, 3);
  
}
  
// draws one squared circle figure.
public static void drawCircles( Graphics g, int x, int y,
int width, int numCircles ) {   
// draw square background
g.setColor( Color.GREEN );
g.fillRect( x, y, width, width );
  
// draw circles background
g.setColor( Color.YELLOW );
g.fillOval( x, y, width, width );
  
// draw circles from outside to inside
///////////////// Your code goes here
g.setColor( Color.BLACK );
for( int i = 0; i < numCircles; i++ ) {
   g.drawOval( x + i * width / (2 * numCircles),
           y + i * width / (2 * numCircles),
           width - i * width / numCircles,
           width - i * width / numCircles);
}
  
  
// box it in
g.drawRect( x, y, width, width );
  
// horizontal line through the middle
///////////////// Your code goes here
g.drawLine( x, y + width / 2, x+ width, y + width / 2 );
  
// vertical line through the middle   
///////////////// Your code goes here
g.drawLine( x +width / 2, y, x + width / 2, y + width );
}
}

Answers

(5)
Status NEW Posted 27 Aug 2017 03:08 PM My Price 12.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)