1. Create a bubble sort code

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please help me with this using java. If yo can't do all of them just do #1 and #3

1. Create a bubble sort code

2. Create a matching games like the on below. And add a reset button ( refer to image below)

3. please add comments to the tower of Hanoi java code below

import java.util.Scanner; public class TowerOfHanoi { public static void shift(int n, String startPole, String intermediatePole, String endPole) { if (n == 0) { return; } shift(n - 1, startPole, endPole, intermediatePole); System.out.println("Move \"" + n + "\" from " + startPole + " --> " + endPole); shift(n - 1, intermediatePole, startPole, endPole); } public static void main(String[] args) { System.out.print("Enter number of discs: "); Scanner scanner = new Scanner(System.in); int numberOfDiscs = scanner.nextInt(); shift(numberOfDiscs, "Pole1", "Pole2", "Pole3"); } }

# Halloween Matching

## Instructions:
1. Add the array to make these pictures.
2. Add a reset button. Change its font and color. Its actionCommand must be “Reset”.
3. Add a title. Change its font.

### Visual Explanation:
- On the left, there is a grid showing a 4x3 arrangement of Halloween-themed images, such as pumpkins, vampires, and monsters.
- On the right, there is an empty 4x3 grid with cards faced down, indicating the game setup where players match pairs.

### Starter Code:

```java
import javax.swing.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.*;

public class halloween extends Applet implements ActionListener {
    int hallow[] = new int[12];
    int rows = 4;
    int cols = 3;
    JButton pics[] = new JButton[rows * cols];

    public void init() {
        Panel grid = new Panel(new GridLayout(rows, cols));
        int n = 0;
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                pics[n] = new JButton(createImageIcon("back.png"));
                pics[n].addActionListener(this);
                pics[n].setActionCommand(n + "");
                pics[n].setPreferredSize(new Dimension(128, 128));
                grid.add(pics[n]);
                n++;
            }
        }
    }
}
```

### Icons:
- Small icons representing different images like `hal1.png`, `hal2.png`, `hal3.png`, `hal4.png`, etc., show possible image choices for the game.

### Explanation:
- This code sets up a basic Halloween-themed matching game using a grid layout.
- Each cell in the grid is implemented as a `JButton`, initially displaying a "back" image indicating the card is faced down.
- Images are to be revealed based on actions triggered by player interaction (clicks).
Transcribed Image Text:# Halloween Matching ## Instructions: 1. Add the array to make these pictures. 2. Add a reset button. Change its font and color. Its actionCommand must be “Reset”. 3. Add a title. Change its font. ### Visual Explanation: - On the left, there is a grid showing a 4x3 arrangement of Halloween-themed images, such as pumpkins, vampires, and monsters. - On the right, there is an empty 4x3 grid with cards faced down, indicating the game setup where players match pairs. ### Starter Code: ```java import javax.swing.*; import java.applet.*; import java.awt.event.*; import java.awt.*; public class halloween extends Applet implements ActionListener { int hallow[] = new int[12]; int rows = 4; int cols = 3; JButton pics[] = new JButton[rows * cols]; public void init() { Panel grid = new Panel(new GridLayout(rows, cols)); int n = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { pics[n] = new JButton(createImageIcon("back.png")); pics[n].addActionListener(this); pics[n].setActionCommand(n + ""); pics[n].setPreferredSize(new Dimension(128, 128)); grid.add(pics[n]); n++; } } } } ``` ### Icons: - Small icons representing different images like `hal1.png`, `hal2.png`, `hal3.png`, `hal4.png`, etc., show possible image choices for the game. ### Explanation: - This code sets up a basic Halloween-themed matching game using a grid layout. - Each cell in the grid is implemented as a `JButton`, initially displaying a "back" image indicating the card is faced down. - Images are to be revealed based on actions triggered by player interaction (clicks).
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education