只含部分代码
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.DecimalFormat;
public class test_5_1 extends JFrame {
JPanel jp1 = null;
JPanel jp2 = null;
JPanel jp3 = null;
JPanel jp4 = null;
JPanel jp5 = null;
JPanel jp6 = null;
public static void main(String[] args) {
test_5_1 window = new test_5_1();
}
public test_5_1() {
jp1 = new JPanel();
jp2 = new JPanel();
jp3 = new JPanel();
jp4 = new JPanel();
jp5 = new JPanel();
jp6 = new JPanel();
JLabel jl1 = new JLabel("简易计算器");
JLabel jl2 = new JLabel("运算数一");
JLabel jl3 = new JLabel("运算数二");
JLabel jl4 = new JLabel("运算结果");
JLabel jl5 = new JLabel(" ");
JTextField jtf1 = new JTextField(8);
JTextField jtf2 = new JTextField(8);
JTextField jtf3 = new JTextField(8);
JButton jb1 = new JButton("相加");
jb1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String num1 = jtf1.getText().trim();
String num2 = jtf2.getText().trim();
double num3 = Double.parseDouble(num1) + Double.parseDouble(num2);
DecimalFormat decimalFormat = new DecimalFormat("#.######");
jtf3.setText(decimalFormat.format(num3));
}
});
JButton jb2 = new JButton("相减");
jb2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String num1 = jtf1.getText().trim();
String num2 = jtf2.getText().trim();
double num3 = Double.parseDouble(num1) - Double.parseDouble(num2);
DecimalFormat decimalFormat = new DecimalFormat("#.######");
jtf3.setText(decimalFormat.format(num3));
}
});
JButton jb3 = new JButton("全部清零");
jb3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jtf1.setText("");
jtf2.setText("");
jtf3.setText("");
}
});
jp1.add(jl1);
jp2.add(jl2);
jp2.add(jtf1);
jp3.add(jl3);
jp3.add(jtf2);
jp4.add(jl4);
jp4.add(jtf3);
jp5.add(jb1);
jp5.add(jl5);
jp5.add(jb2);
jp6.add(jb3);
this.add(jp1);
this.add(jp2);
this.add(jp3);
this.add(jp4);
this.add(jp5);
this.add(jp6);
this.setLayout(new GridLayout(6, 1, 1, 1));
this.setTitle("简单计算器");
this.setSize(300, 350);
this.setLocationRelativeTo(null);
this.setResizable(false);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.DecimalFormat;
public class test_5_2 extends JFrame {
JPanel jp1 = null;
JPanel jp2 = null;
JPanel jp3 = null;
JPanel jp4 = null;
JPanel jp5 = null;
JPanel jp6 = null;
public static void main(String[] args) {
test_5_2 window = new test_5_2();
}
public test_5_2() {
jp1 = new JPanel();
jp2 = new JPanel();
jp3 = new JPanel();
jp4 = new JPanel();
jp5 = new JPanel();
jp6 = new JPanel();
JLabel jl1 = new JLabel("简易计算器");
JLabel jl2 = new JLabel("运算数一");
JLabel jl3 = new JLabel("运算数二");
JLabel jl4 = new JLabel("运算结果");
JLabel jl5 = new JLabel(" ");
JTextField jtf1 = new JTextField(8);
JTextField jtf2 = new JTextField(8);
JTextField jtf3 = new JTextField(8);
JButton jb1 = new JButton("相加");
jb1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String num1 = jtf1.getText().trim();
String num2 = jtf2.getText().trim();
if (num1.isEmpty() || num2.isEmpty()) {
JOptionPane.showMessageDialog(null, "请输入运算数!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
int dot1 = num1.indexOf(".");
int dot2 = num2.indexOf(".");
if (dot1 >= 0 && num1.substring(dot1 + 1).indexOf(".") >= 0 || dot2 >= 0 && num2.substring(dot2 + 1).indexOf(".") >= 0) {
JOptionPane.showMessageDialog(null, "小数点的个数不能超过1个!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
if (!isNumeric(num1) || !isNumeric(num2)) {
JOptionPane.showMessageDialog(null, "输入的数据含有非法字符!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
if (num1.startsWith(".") || num1.endsWith(".") || num2.startsWith(".") || num2.endsWith(".")) {
JOptionPane.showMessageDialog(null, "小数点的位置不正确!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
double num3 = Double.parseDouble(num1) + Double.parseDouble(num2);
DecimalFormat decimalFormat = new DecimalFormat("#.######");
jtf3.setText(decimalFormat.format(num3));
}
});
JButton jb2 = new JButton("相减");
jb2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String num1 = jtf1.getText().trim();
String num2 = jtf2.getText().trim();
if (num1.isEmpty() || num2.isEmpty()) {
JOptionPane.showMessageDialog(null, "请输入运算数!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
int dot1 = num1.indexOf(".");
int dot2 = num2.indexOf(".");
if (dot1 >= 0 && num1.substring(dot1 + 1).indexOf(".") >= 0 || dot2 >= 0 && num2.substring(dot2 + 1).indexOf(".") >= 0) {
JOptionPane.showMessageDialog(null, "小数点的个数不能超过1个!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
if (!isNumeric(num1) || !isNumeric(num2)) {
JOptionPane.showMessageDialog(null, "输入的数据含有非法字符!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
if (num1.startsWith(".") || num1.endsWith(".") || num2.startsWith(".") || num2.endsWith(".")) {
JOptionPane.showMessageDialog(null, "小数点的位置不正确!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
double num3 = Double.parseDouble(num1) - Double.parseDouble(num2);
DecimalFormat decimalFormat = new DecimalFormat("#.######");
jtf3.setText(decimalFormat.format(num3));
}
});
JButton jb3 = new JButton("全部清零");
jb3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jtf1.setText("");
jtf2.setText("");
jtf3.setText("");
}
});
jp1.add(jl1);
jp2.add(jl2);
jp2.add(jtf1);
jp3.add(jl3);
jp3.add(jtf2);
jp4.add(jl4);
jp4.add(jtf3);
jp5.add(jb1);
jp5.add(jl5);
jp5.add(jb2);
jp6.add(jb3);
this.add(jp1);
this.add(jp2);
this.add(jp3);
this.add(jp4);
this.add(jp5);
this.add(jp6);
this.setLayout(new GridLayout(6, 1, 1, 1));
this.setTitle("简单计算器");
this.setSize(300, 350);
this.setLocationRelativeTo(null);
this.setResizable(false);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public boolean isNumeric(String str) {
if (str.isEmpty()) {
return false;
}
int i = 0;
if (str.charAt(0) == '-') {
if (str.length() > 1 && Character.isDigit(str.charAt(1))) {
i++;
} else {
return false;
}
}
boolean hasDot = false;
for (; i < str.length(); i++) {
char ch = str.charAt(i);
if (ch == '.') {
if (hasDot) {
return false;
}
hasDot = true;
} else if (!Character.isDigit(ch)) {
return false;
}
}
return true;
}
}
1、编写一个 Java 程序,能将硬盘上某个文件夹下的一个文件拷贝到另一个指定的文件
夹中。注意,测试时要能通过小文件和大文件测试,验证你的程序具有通用性,保证不管
文件大小都要能拷贝成功,且速度不会太慢。
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Scanner;
import java.io.InputStream;
import java.io.OutputStream;
public class test_6_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str1 = sc.next();
String str2 = sc.next();
String str3 = sc.next();
try {
File sourceDirFile = new File(str1);
File targetDirFile = new File(str2);
if (!sourceDirFile.exists()) {
sourceDirFile.mkdir();
}
if (!targetDirFile.exists()) {
targetDirFile.mkdir();
}
long startTime = System.currentTimeMillis();
startTime = System.currentTimeMillis();
String sourceFile = str1 + File.separator + str3;
FileInputStream input = new FileInputStream(sourceFile);
FileOutputStream output = new FileOutputStream(str2 + File.separator + str3);
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = input.read(buffer)) != -1) {
output.write(buffer, 0, bytesRead);
}
input.close();
output.close();
System.out.println("文件已成功复制。");
System.out.println("缓冲字节流使用byte缓冲数组完成复制,耗时"+(System.currentTimeMillis()-startTime)+"毫秒");
} catch (Exception e) {
System.out.println("复制文件时出现错误:" + e.getMessage());
}
}
}
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class test_6_2_1 {
public static void main(String args[]) {
File5Frm file5Frm = new File5Frm();
}
}
class File5Frm extends Frame implements ActionListener {
FileDialog sv, op;
JButton button1, button2, button3, button4,button5;
JTextArea textArea = new JTextArea();
File5Frm() {
super("工资记录修改器");
setLayout(null);
setBackground(Color.GRAY);
setSize(700, 350);
setVisible(true);
button1 = new JButton("打开");
button2 = new JButton("保存");
button3 = new JButton("关闭");
button4 = new JButton("按比例增加");
button5 = new JButton("按固定增加");
textArea = new JTextArea("姓名\t工资\t津贴\n");
add(button1);
add(button2);
add(button3);
add(button4);
add(button5);
add(textArea);
textArea.setBounds(30, 50, 460, 220);
button1.setBounds(560, 60, 120, 30);
button2.setBounds(560, 120, 120, 30);
button3.setBounds(560, 180, 120, 30);
button4.setBounds(560, 240, 120, 30);
button5.setBounds(560, 300, 120, 30);
sv = new FileDialog(this, "保存", FileDialog.SAVE);
op = new FileDialog(this, "打开", FileDialog.LOAD);
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
button5.addActionListener(this);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == button1) {
String str;
op.setVisible(true);
try {
File f1 = new File(op.getDirectory(), op.getFile());
FileReader fr = new FileReader(f1);
BufferedReader br = new BufferedReader(fr);
textArea.setText("");
while ((str = br.readLine()) != null) textArea.append(str + '\n');
fr.close();
} catch (Exception e1) {
}
}
if (e.getSource() == button2) {
sv.setVisible(true);
try {
File fl = new File(sv.getDirectory(), sv.getFile());
FileWriter fw = new FileWriter(fl);
BufferedWriter bw = new BufferedWriter(fw);
String gt = textArea.getText();
bw.write(gt, 0, gt.length());
bw.flush();
fw.close();
} catch (Exception e1) {
}
}
if (e.getSource() == button3) {
System.exit(0);
}
if (e.getSource() == button4) {
String gt = textArea.getText();
String s[];
s = gt.split("\t|\n");
textArea.setText("姓名\t工资\t津贴\n");
try {
for (int i = 1; i < s.length; i++) {
s[3 * i + 1] = String.valueOf((int) (Integer.parseInt((s[3 * i + 1])) * 1.1));
textArea.append(s[3 * i + 0] + "\t");
textArea.append(s[3 * i + 1] + "\t");
textArea.append(s[3 * i + 2] + "\n");
}
} catch (Exception e1) {
}
}
if (e.getSource() == button5) {
String gt = textArea.getText();
String s[];
s = gt.split("\t|\n");
textArea.setText("姓名\t工资\t津贴\n");
try {
for (int i = 1; i < s.length; i++) {
s[3 * i + 1] = String.valueOf((int) (Integer.parseInt((s[3 * i + 1])) +100));
textArea.append(s[3 * i + 0] + "\t");
textArea.append(s[3 * i + 1] + "\t");
textArea.append(s[3 * i + 2] + "\n");
}
} catch (Exception e1) {
}
}
}
}
public class test_7_1 {
public static void main(String[] args) {
MyThread01 m1 = new MyThread01();
Thread thread1 = new Thread(m1,"2100301210");
Thread thread2 = new Thread(m1,"chenshiyu");
thread1.start();
thread2.start();
}
}
class MyThread01 implements Runnable {
int num = 1;
public void run() {
while (true) {
if (num <= 4) {
num++;
System.out.println(Thread.currentThread().getName() );
} else {
break;
}
}
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class task {
public static void main(String[] args) {
MyWindow t=new MyWindow();
t.setSize(300, 250);
t.setVisible(true);
t.setDefaultCloseOperation(MyWindow.EXIT_ON_CLOSE);
}
}
class MyWindow extends JFrame implements ActionListener
{
JLabel lb1=new JLabel("账号:");
JLabel lb2=new JLabel("密码:");
JTextField txtUid=new JTextField(20);
JPasswordField txtPwd=new JPasswordField(20);
JButton btnLogin=new JButton("登录");
JButton btnReset=new JButton("重置");
public MyWindow()
{
GridLayout layout=new GridLayout(5,1);
setLayout(layout);
add(new JLabel(""));
JPanel pnl=new JPanel();
pnl.add(lb1);
pnl.add(txtUid);
add(pnl);
pnl=new JPanel();
pnl.add(lb2);
pnl.add(txtPwd);
add(pnl);
pnl=new JPanel();
pnl.add(btnLogin);
pnl.add(btnReset);
add(pnl);
add(new JLabel(""));
btnLogin.addActionListener(this);
btnReset.addActionListener(this);
setTitle("用户登录");
}
public void actionPerformed(ActionEvent e) {
String msg="";
if(e.getSource()==btnLogin)
{
if(txtUid.getText().equals("admin")&&txtPwd.getText().equals("java")){
msg="登录成功";
}
else {
msg="用户名或密码错";
}
JOptionPane.showMessageDialog(this, msg);
}
else if(e.getSource()==btnReset){
txtUid.setText("");
txtPwd.setText("");
}
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
public class test extends JFrame {
private JPanel contentPane;
private JTextField txtNumber;
private JButton btnCompute;
private JTextArea txtAreaResult;
private BtnComputeActionListener listener;
private JScrollPane scrollPane;
private JButton btnExit;
public static boolean isPrime(int n) {
if (n <= 1) {
return false;
}
for (int i = 2; i <= Math.sqrt(n); i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
public static void main(String[] args) {
test frame = new test();
frame.setVisible(true);
}
public test() {
setResizable(false);
setTitle("素数判断程序");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 612, 314);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
JLabel lblNewLabel = new JLabel("输入一个整数:");
lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 14));
getContentPane().add(lblNewLabel);
txtNumber = new JTextField();
contentPane.add(txtNumber);
txtNumber.setColumns(10);
btnCompute = new JButton("执行判断");
this.listener = new BtnComputeActionListener();
btnCompute.addActionListener(this.listener);
contentPane.add(btnCompute);
scrollPane = new JScrollPane();
contentPane.add(scrollPane);
txtAreaResult = new JTextArea();
scrollPane.setViewportView(txtAreaResult);
txtAreaResult.setLineWrap(true);
txtAreaResult.setWrapStyleWord(true);
txtAreaResult.setColumns(50);
txtAreaResult.setRows(10);
btnExit = new JButton("退出");
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
contentPane.add(btnExit);
this.setLocationRelativeTo(null);
}
private class BtnComputeActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
String inputStr = txtNumber.getText();
try {
int inputNum = Integer.valueOf(inputStr);
if (isPrime(inputNum)) {
txtAreaResult.setText(inputNum + " 是素数。");
} else {
txtAreaResult.setText(inputNum + " 不是素数。");
}
} catch (NumberFormatException exception) {
txtAreaResult.setText("请输入整数!");
}
}
}
}
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
public class task_2 {
private List<Book> bookList = new ArrayList<>();
private JFrame loginFrame;
private JLabel usernameLabel;
private JLabel passwordLabel;
private JTextField usernameField;
private JPasswordField passwordField;
private JButton loginButton;
private JFrame mainFrame;
private JLabel titleLabel;
private JLabel idLabel;
private JLabel nameLabel;
private JLabel authorLabel;
private JLabel yearLabel;
private JTextField idField;
private JTextField nameField;
private JTextField authorField;
private JTextField yearField;
private JButton addButton;
private JButton searchButton;
private JButton borrowButton;
private JButton deleteButton;
public task_2() {
initializeLoginFrame();
}
private void initializeLoginFrame() {
loginFrame = new JFrame("Login");
usernameLabel = new JLabel("Username:");
passwordLabel = new JLabel("Password:");
usernameField = new JTextField();
passwordField = new JPasswordField();
loginButton = new JButton("Login");
usernameLabel.setBounds(50, 50, 80, 30);
passwordLabel.setBounds(50, 100, 80, 30);
usernameField.setBounds(130, 50, 200, 30);
passwordField.setBounds(130, 100, 200, 30);
loginButton.setBounds(150, 150, 100, 30);
loginButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (usernameField.getText().equals("admin") && passwordField.getText().equals("admin")) {
initializeMainFrame();
loginFrame.dispose();
} else {
JOptionPane.showMessageDialog(loginFrame, "Incorrect username or password!", "Login Failed", JOptionPane.ERROR_MESSAGE);
}
}
});
loginFrame.add(usernameLabel);
loginFrame.add(passwordLabel);
loginFrame.add(usernameField);
loginFrame.add(passwordField);
loginFrame.add(loginButton);
loginFrame.setSize(400, 250);
loginFrame.setLayout(null);
loginFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
loginFrame.setVisible(true);
}
private void initializeMainFrame() {
mainFrame = new JFrame("Library Management System");
titleLabel = new JLabel("Book List");
titleLabel.setFont(new Font("Arial", Font.BOLD, 24));
idLabel = new JLabel("Book ID:");
nameLabel = new JLabel("Book Name:");
authorLabel = new JLabel("Author:");
yearLabel = new JLabel("Year:");
idField = new JTextField();
nameField = new JTextField();
authorField = new JTextField();
yearField = new JTextField();
addButton = new JButton("Add");
searchButton = new JButton("Search");
borrowButton = new JButton("Borrow");
deleteButton = new JButton("Delete");
titleLabel.setBounds(200, 50, 150, 30);
idLabel.setBounds(50, 100, 80, 30);
nameLabel.setBounds(50, 150, 80, 30);
authorLabel.setBounds(50, 200, 80, 30);
yearLabel.setBounds(50, 250, 80, 30);
idField.setBounds(130, 100, 200, 30);
nameField.setBounds(130, 150, 200, 30);
authorField.setBounds(130, 200, 200, 30);
yearField.setBounds(130, 250, 200, 30);
addButton.setBounds(50, 350, 100, 30);
searchButton.setBounds(200, 350, 100, 30);
borrowButton.setBounds(350, 350, 100, 30);
deleteButton.setBounds(500, 350, 100, 30);
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addBook();
}
});
searchButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
searchBook();
}
});
borrowButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
borrowBook();
}
});
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
deleteBook();
}
});
mainFrame.add(titleLabel);
mainFrame.add(idLabel);
mainFrame.add(nameLabel);
mainFrame.add(authorLabel);
mainFrame.add(yearLabel);
mainFrame.add(idField);
mainFrame.add(nameField);
mainFrame.add(authorField);
mainFrame.add(yearField);
mainFrame.add(addButton);
mainFrame.add(searchButton);
mainFrame.add(borrowButton);
mainFrame.add(deleteButton);
mainFrame.setSize(700, 500);
mainFrame.setLayout(null);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setVisible(true);
}
private void addBook() {
String id = idField.getText();
String name = nameField.getText();
String author = authorField.getText();
String year = yearField.getText();
Book book = new Book(id, name, author, year);
bookList.add(book);
JOptionPane.showMessageDialog(mainFrame, "Book added successfully!", "Add Book", JOptionPane.INFORMATION_MESSAGE);
}
private void searchBook() {
String id = idField.getText();
for (Book book : bookList) {
if (book.getId().equals(id)) {
nameField.setText(book.getName());
authorField.setText(book.getAuthor());
yearField.setText(book.getYear());
return;
}
}
JOptionPane.showMessageDialog(mainFrame, "Book not found!", "Search Book", JOptionPane.ERROR_MESSAGE);
}
private void borrowBook() {
String id = idField.getText();
for (Book book : bookList) {
if (book.getId().equals(id)) {
if (book.isBorrowed()) {
JOptionPane.showMessageDialog(mainFrame, "Book has been borrowed!", "Borrow Book", JOptionPane.ERROR_MESSAGE);
} else {
book.setBorrowed(true);
JOptionPane.showMessageDialog(mainFrame, "Book borrowed successfully!", "Borrow Book", JOptionPane.INFORMATION_MESSAGE);
}
return;
}
}
JOptionPane.showMessageDialog(mainFrame, "Book not found!", "Borrow Book", JOptionPane.ERROR_MESSAGE);
}
private void deleteBook() {
String id = idField.getText();
for (Book book : bookList) {
if (book.getId().equals(id)) {
bookList.remove(book);
JOptionPane.showMessageDialog(mainFrame, "Book deleted successfully!", "Delete Book", JOptionPane.INFORMATION_MESSAGE);
idField.setText("");
nameField.setText("");
authorField.setText("");
yearField.setText("");
return;
}
}
JOptionPane.showMessageDialog(mainFrame, "Book not found!", "Delete Book", JOptionPane.ERROR_MESSAGE);
}
private class Book {
private String id;
private String name;
private String author;
private String year;
private boolean borrowed;
public Book(String id, String name, String author, String year) {
this.id = id;
this.name = name;
this.author = author;
this.year = year;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getAuthor() {
return author;
}
public String getYear() {
return year;
}
public boolean isBorrowed() {
return borrowed;
}
public void setBorrowed(boolean borrowed) {
this.borrowed = borrowed;
}
}
public static void main(String[] args) {
task_2 libraryManagementSystem = new task_2();
}
}