Chat with us, powered by LiveChat There are three spinners that display digits. When the button is clicked, the spinners should all start "spinning" (that is, they continuously increment the digit displayed, wrapping around to zero when necessary) - Wridemy

There are three spinners that display digits. When the button is clicked, the spinners should all start “spinning” (that is, they continuously increment the digit displayed, wrapping around to zero when necessary)

so that it simulates a slot machine. There are three spinners that display digits. When the button is clicked, the spinners should all start “spinning” (that is, they continuously increment the digit displayed, wrapping around to zero when necessary). Each subsequent time the button is clicked, one spinner should stop. After all three spinners stop, the game should display a message indicating whether the player won (all three digits are the same). If the user clicks the button again, the spinners all start spinning and the game continues.

Each spinner is controlled by a thread. Each thread must only control one spinner. You should vary the speeds of the spinners (using Thread.sleep()) for a more interesting result. DO NOT USE SYCHRONIZED. using eclipse

import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
public class SlotMachine extends JFrame implements ActionListener {
public static void main(String[] args) {
new SlotMachine();
}
private JLabel spinner1; // Left digit display
private JLabel spinner2; // Middle digit display
private JLabel spinner3; // Right digit display
private int[] values; // Digit values
private JButton startStop; // Button to start or stop spinner(s)
// Constructor
public SlotMachine() {
super(“Slots!”);
values = new int[3];
makeFrame();
}
// Makes all three digits start spinning.
public void startSpinning() {
// WRITE ME!!!
}
// Makes one digit stop spinning.
// If all digits stop, displays a message if all three digits are the same.
public void stopSpinning() {
// WRITE ME TOO!!!
}
// This method is called when Start/Stop button is clicked.
public void actionPerformed(ActionEvent e) {
if(startStop.getText().equals(“START”)) {
startStop.setText(“STOP”);
startSpinning();
} else {
stopSpinning();
}
}
// Builds the window and makes it appear!
private void makeFrame() {
setLayout(new BorderLayout(5, 5));
JPanel spinnerPanel = new JPanel(new GridLayout(1, 3, 5, 5));
spinner1 = new JLabel(“0”, JLabel.CENTER);
spinner1.setFont(new Font(null, Font.BOLD, 40));

spinnerPanel.add(spinner1);

spinner2 = new JLabel(“0”, JLabel.CENTER);
spinner2.setFont(new Font(null, Font.BOLD, 40));
spinnerPanel.add(spinner2);
spinner3 = new JLabel(“0”, JLabel.CENTER);
spinner3.setFont(new Font(null, Font.BOLD, 40));
spinnerPanel.add(spinner3);
add(spinnerPanel, BorderLayout.CENTER);
startStop = new JButton(“START”);
startStop.setFont(new Font(null, Font.ITALIC, 20));
startStop.addActionListener(this);
add(startStop, BorderLayout.SOUTH);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(200, 150);
setLocationRelativeTo(null);
setVisible(true);

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Wridemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order