基于java电影院管理系统
时间: 2024-01-01 10:05:01 浏览: 96
<<引用[1]:https://www.geeksforgeeks.org/java-program-to-create-a-simple-movie-ticket-booking-system/。引用:https://www.codejava.net/java-se/swing/a-simple-movie-ticket-booking-system>>。
以下是基于Java的电影院管理系统的简单演示:
1. 电影票预订系统
```java
import java.util.Scanner;
public class MovieTicketBookingSystem {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Welcome to the Movie Ticket Booking System");
System.out.println("Enter the number of tickets to book:");
int numberOfTickets = input.nextInt();
System.out.println("Tickets booked successfully for " + numberOfTickets + " people.");
}
}
```
2. 电影票预订系统GUI界面
```java
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MovieTicketBookingSystemGUI {
public static void main(String[] args) {
JFrame frame = new JFrame("Movie Ticket Booking System");
JButton bookTicketButton = new JButton("Book Ticket");
bookTicketButton.setBounds(100, 100, 200, 40);
bookTicketButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame, "Ticket booked successfully!");
}
});
frame.add(bookTicketButton);
frame.setSize(400, 300);
frame.setLayout(null);
frame.setVisible(true);
}
}
```
阅读全文