Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a solution for the Programming exercise P10.18 (Bull\'s eye). You can

ID: 3830010 • Letter: I

Question

Implement a solution for the Programming exercise P10.18 (Bull's eye). You can do this using the filloval method. A circle is just an oval whose height and width are the same. Make the circle diameters 50, 100, 150, 200 and 250 units. You can put both classes in the same file as long as only one is declared public You can modify the ChartViewer program to do this. The code for the entire program is on lsidore as a text file. submit the code and a screen shot of the frame through lsidore assignments feature. Use the submission template. P10.18 Draw a bull's eye a set of concentric rings in alternating black and white colors. Hint: Fill a black circle, then fill er white circle on top, and so on. Your pro- gram should be composed of classes ecomponent and BullsEyeviewer.

Explanation / Answer

import java.applet.Applet; import java.awt.*; import javax.swing.*; import java.awt.*; public class Bullseye { public static void main(String[] args) { BullseyeFrame frame = new BullseyeFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } /** A frame that contains a message panel */ class BullseyeFrame extends JFrame { public BullseyeFrame() { setTitle("Bullseye"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); BullseyePanel panel = new BullseyePanel(); getContentPane().add(panel); } public static final int DEFAULT_WIDTH = 400; public static final int DEFAULT_HEIGHT = 400; } class BullseyePanel extends JPanel { //----------------------------------------------------------------- // Paints a bullseye target. //----------------------------------------------------------------- public void paintComponent (Graphics page) { super.paintComponent(page); final int MAX_WIDTH = 300, NUM_RINGS = 5, RING_WIDTH = 25; int x = 0, y = 0, diameter; setBackground (Color.cyan); diameter = MAX_WIDTH; page.setColor (Color.white); for (int count = 0; count
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote