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

The goal of this project is to become more familiar with creating and using clas

ID: 3656719 • Letter: T

Question

The goal of this project is to become more familiar with creating and using classes and objects in Java. In order

to do so, you will create a Person class. Your class will keep track of how many parts are not shown, display

the next item when a method is called, and reset. You will also create a small test application to test your new

Person class. The objective here is to become more familiar with creating and modifying classes as well as

manipulating objects. This is a creative assignment. No two pictures will (should) be the same.


Instructions

Explanation / Answer

import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.JFrame; class Person extends JPanel {           private int triesLeft;           public Person ()     {         triesLeft = 6;         this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) {             if (triesLeft > 0)                 showNext();             else reset();             }});}                                   public int getNumLeft()     {         return triesLeft;     }           public void reset()     {         triesLeft = 6;         repaint();     }     public void showNext()     {         triesLeft = triesLeft - 1;     }                             public void paintComponent(Graphics g){         super.paintComponent(g);         this.setBackground(Color.YELLOW);                   if (triesLeft
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