java汽車售票系統(tǒng)代碼 java汽車售票系統(tǒng)代碼查詢

求一個(gè) java+mysql做的車站售票系統(tǒng),有數(shù)據(jù)庫的增刪改查就行了。要有完整的數(shù)據(jù)庫哦,謝謝~ 100分送上

你好,這個(gè)估計(jì)很少。理由如下:

成都創(chuàng)新互聯(lián)公司專注于東平企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè)公司,商城網(wǎng)站開發(fā)。東平網(wǎng)站建設(shè)公司,為東平等地區(qū)提供建站服務(wù)。全流程定制網(wǎng)站開發(fā),專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)

1)這個(gè)用分難求,要用工程銀子,因?yàn)檫@個(gè)項(xiàng)目多數(shù)個(gè)人沒有,除非公司的東西,還得做這個(gè)項(xiàng)目的公司;

2)即使他公司有也不敢拿,違法且項(xiàng)目很大,部署很難;

3)即使以上都不考慮,個(gè)人為這個(gè)分?jǐn)?shù)現(xiàn)開發(fā),那么也很費(fèi)神,要設(shè)計(jì)數(shù)據(jù)庫。工作量不少。少,要一些人天工時(shí)。

java編程:簡單的售票系統(tǒng)問題

你的不是調(diào)試的問題 是錯(cuò) 通過編譯了 但是你想實(shí)現(xiàn)的沒有 很多錯(cuò)誤拋出了 。。。

求下題代碼,java題目。

Java程序:

import?java.io.IOException;

import?java.util.ArrayList;

import?java.util.List;

import?java.util.Scanner;

/**

*?汽車類

*/

class?Car?{

/**

?*?汽車編號(hào)

?*/

protected?int?id?=?0;

/**

?*?汽車款式

?*/

protected?String?type?=?null;

/**

?*?構(gòu)造汽車對(duì)象

?*/

public?Car()?{

}

/**

?*?構(gòu)造汽車對(duì)象

?*?@param?id?汽車編號(hào)

?*?@param?type?汽車款式

?*/

public?Car(int?id,?String?type)?{

this.id?=?id;

this.type?=?type;

}

/**

?*?獲得汽車編號(hào)

?*?@return?汽車編號(hào)

?*/

public?int?getId()?{

return?this.id;

}

/**

?*?獲得汽車款式

?*?@return?汽車款式

?*/

public?String?getType()?{

return?this.type;

}

}

/**

*?汽車銷售人員類

*/

class?Saler?{

/**

?*?姓名

?*/

protected?String?name?=?null;

public?ListCar?cars?=?new?ArrayListCar();

/**

?*?構(gòu)造銷售汽車人員對(duì)象

?*/

public?Saler()?{

}

/**

?*?構(gòu)造汽車銷售人員對(duì)象

?*?@param?name?姓名

?*/

public?Saler(String?name)?{

this.name?=?name;

}

/**

?*?獲得姓名

?*?@return?姓名

?*/

public?String?getName()?{

return?this.name;

}

}

public?class?Main?{

public?static?void?main(String[]?args)?{

Scanner?scan?=?new?Scanner(System.in);

ListCar?allCar?=?new?ArrayListCar(); //待售汽車對(duì)象的集合

allCar.add(new?Car(1001,?"凱越"));

allCar.add(new?Car(1002,?"凱越"));

allCar.add(new?Car(1003,?"凱越"));

allCar.add(new?Car(1004,?"凱越"));

allCar.add(new?Car(2001,?"君威"));

allCar.add(new?Car(2002,?"君威"));

allCar.add(new?Car(2003,?"君威"));

allCar.add(new?Car(2004,?"君威"));

allCar.add(new?Car(2005,?"君威"));

Saler?saler?=?new?Saler("張三其");

int?choice?=?0;

int?type; //銷售車型

int?num; //銷售數(shù)量

while(true)?{

System.out.println("請(qǐng)選擇銷售方式");

System.out.println("按車輛銷售:\t1");

System.out.println("按車型銷售:\t2");

System.out.println("查看銷售情況:\t3");

System.out.println("退出:\t\t0");

System.out.print("您的選擇:");

choice?=?scan.nextInt();

switch(choice)?{

case?0: //退出系統(tǒng)

System.out.println("退出系統(tǒng)");

System.exit(0);

break;

case?1: //按車輛銷售

for(Car?car?:?allCar)?{

if(!?exists(saler.cars,?car))?{

saler.cars.add(car);

System.out.printf("\t售出?%s?1?輛\n",?car.getType());

break;

}

}

break;

case?2: //按車型銷售

System.out.print("車型(凱越??0/君威??1):");

type?=?scan.nextInt();

System.out.print("銷售數(shù)量:");

num?=?scan.nextInt();

int?c?=?0; //實(shí)際銷售數(shù)量

for(Car?car?:?allCar)?{

if(c?=?num)?{

break;

}

if(car.getType().equals(type?==?0???"凱越"?:?"君威")??!?exists(saler.cars,?car))?{

saler.cars.add(car);

c++;

}

}

if(c??num)?{

System.out.printf("\t庫存不足,實(shí)際售出?%s?%d?輛\n",?type?==?0???"凱越"?:?"君威",?c);

}

else?{

System.out.printf("\t售出?%s?%d?輛\n",?type?==?0???"凱越"?:?"君威",?num);

}

break;

case?3: //查看銷售情況

System.out.println("\t當(dāng)前銷售情況一覽");

System.out.printf("\t%10s%10s\n",?"汽車款式",?"汽車編號(hào)");

for(Car?car?:?saler.cars)?{

System.out.printf("\t%10s%10d\n",?car.getType(),?car.getId());

}

System.out.println("---------------------------");

System.out.printf("\t小計(jì):\t%d?輛\n",?saler.cars.size());

break;

default:

break;

}

try?{

System.in.read();

}?catch?(IOException?e)?{

//?TODO?Auto-generated?catch?block

e.printStackTrace();

}

}

}

//判斷car在cars中是否存在

public?static?boolean?exists(ListCar?cars,?Car?car)?{

for(Car?c?:?cars)?{

if(c.getId()?==?car.getId())?{

return?true;

}

}

return?false;

}

}

運(yùn)行測(cè)試:

請(qǐng)選擇銷售方式

按車輛銷售: 1

按車型銷售: 2

查看銷售情況: 3

退出: 0

您的選擇:1

售出?凱越?1?輛

請(qǐng)選擇銷售方式

按車輛銷售: 1

按車型銷售: 2

查看銷售情況: 3

退出: 0

您的選擇:2

車型(凱越??0/君威??1):0

銷售數(shù)量:3

售出?凱越?3?輛

請(qǐng)選擇銷售方式

按車輛銷售: 1

按車型銷售: 2

查看銷售情況: 3

退出: 0

您的選擇:3

當(dāng)前銷售情況一覽

??汽車款式??????汽車編號(hào)

凱越??????1001

凱越??????1002

凱越??????1003

凱越??????1004

---------------------------

小計(jì): 4?輛

請(qǐng)選擇銷售方式

按車輛銷售: 1

按車型銷售: 2

查看銷售情況: 3

退出: 0

您的選擇:0

退出系統(tǒng)

你好,請(qǐng)問一下java模擬5個(gè)窗口售票系統(tǒng)你是如何編寫的,能教我一下嗎?

package yaoshun.Thread;

import java.awt.Color;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;

/*

* 多線程同步輸出

*/

public class MultiThread extends JFrame {

private int ticket; // 計(jì)數(shù)變量

private JButton jButton;

private JLabel jLabel;

private JLabel jLabel1;

private JLabel jLabel2;

private JLabel jLabel3;

private JLabel jLabel4;

private JLabel jLabel5;

private JTextArea jTextArea1;

private JTextArea jTextArea2;

private JTextArea jTextArea3;

private JTextArea jTextArea4;

private JTextArea jTextArea5;

private Thread thread1;

private Thread thread2;

private Thread thread3;

private Thread thread4;

private Thread thread5;

// 構(gòu)造器

public MultiThread() {

setName("火車票銷售情況");

setLayout(null); // 使用絕對(duì)布局

setSize(680, 720);

setResizable(false); // 設(shè)置窗體大小不變

setLocationRelativeTo(null);// 設(shè)置窗體居中

jLabel = new JLabel("火車站售票大廳");

jLabel.setBounds(280, 20, 140, 30);

jLabel.setFont(new Font(getName(), Font.BOLD, 16)); // 設(shè)置字體大小

jLabel.setForeground(Color.BLUE); // 設(shè)置字體顏色

jLabel1 = new JLabel("售票窗1");

jLabel1.setBounds(72, 50, 80, 50);

jLabel1.setForeground(Color.red);

jLabel2 = new JLabel("售票窗2");

jLabel2.setBounds(192, 50, 80, 50);

jLabel2.setForeground(Color.red);

jLabel3 = new JLabel("售票窗3");

jLabel3.setBounds(312, 50, 80, 50);

jLabel3.setForeground(Color.red);

;

jLabel4 = new JLabel("售票窗4");

jLabel4.setBounds(432, 50, 80, 50);

jLabel4.setForeground(Color.red);

jLabel5 = new JLabel("售票窗5");

jLabel5.setBounds(552, 50, 80, 50);

jLabel5.setForeground(Color.red);

jTextArea1 = new JTextArea();

jTextArea1.setBounds(45, 100, 100, 500);

jTextArea1.setEditable(false); // 文本框不可編輯

jTextArea2 = new JTextArea();

jTextArea2.setBounds(165, 100, 100, 500);

jTextArea2.setEditable(false); // 文本框不可編輯

jTextArea3 = new JTextArea();

jTextArea3.setBounds(285, 100, 100, 500);

jTextArea3.setEditable(false); // 文本框不可編輯

jTextArea4 = new JTextArea();

jTextArea4.setBounds(405, 100, 100, 500);

jTextArea4.setEditable(false); // 文本框不可編輯

jTextArea5 = new JTextArea();

jTextArea5.setBounds(525, 100, 100, 500);

jTextArea5.setEditable(false); // 文本框不可編輯

jButton = new JButton("開始售票");

jButton.setBounds(270, 625, 140, 40);

jButton.setFont(new Font(getName(), Font.BOLD, 16));// 設(shè)置字體

jButton.setForeground(Color.blue);

thread1 = new Thread(new MyThread1());

thread2 = new Thread(new MyThread2());

thread3 = new Thread(new MyThread3());

thread4 = new Thread(new MyThread4());

thread5 = new Thread(new MyThread5());

// 為按鈕添加監(jiān)聽器

jButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

thread1.start();

thread2.start();

thread3.start();

thread4.start();

thread5.start();

}

});

add(jLabel);

add(jLabel1);

add(jLabel2);

add(jLabel3);

add(jLabel4);

add(jLabel5);

add(jTextArea1);

add(jTextArea2);

add(jTextArea3);

add(jTextArea4);

add(jTextArea5);

add(jButton);

setVisible(true); // 設(shè)置窗體顯示

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 設(shè)置窗體關(guān)閉

}

class MyThread1 extends Thread {

// 重寫run方法

public synchronized void run() {

while (ticket 100) {

++ticket;

jTextArea1.append("第" + ticket + "張票已售出" + "\n");

try {

Thread.sleep(100);

} catch (InterruptedException e) {

// TODO 自動(dòng)生成的 catch 塊

e.printStackTrace();

}

}

}

}

class MyThread2 extends Thread {

// 重寫run方法

public synchronized void run() {

while (ticket 100) {

++ticket;

jTextArea2.append("第" + ticket + "張票已售出" + "\n");

try {

Thread.sleep(100);

} catch (InterruptedException e) {

// TODO 自動(dòng)生成的 catch 塊

e.printStackTrace();

}

}

}

}

class MyThread3 extends Thread {

// 重寫run方法

public synchronized void run() {

while (ticket 100) {

++ticket;

jTextArea3.append("第" + ticket + "張票已售出" + "\n");

try {

Thread.sleep(100);

} catch (InterruptedException e) {

// TODO 自動(dòng)生成的 catch 塊

e.printStackTrace();

}

}

}

}

class MyThread4 extends Thread {

// 重寫run方法

public synchronized void run() {

while (ticket 100) {

++ticket;

jTextArea4.append("第" + ticket + "張票已售出" + "\n");

try {

Thread.sleep(100);

} catch (InterruptedException e) {

// TODO 自動(dòng)生成的 catch 塊

e.printStackTrace();

}

}

}

}

class MyThread5 extends Thread {

// 重寫run方法

public synchronized void run() {

while (ticket 100) {

++ticket;

jTextArea5.append("第" + ticket + "張票已售出" + "\n");

try {

Thread.sleep(200);

} catch (InterruptedException e) {

// TODO 自動(dòng)生成的 catch 塊

e.printStackTrace();

}

}

}

}

public static void main(String[] args) {

MultiThread multiThread = new MultiThread();

}

}

自己改一下 包名吧,這個(gè)題目是很多學(xué)校在多線程都用來的基礎(chǔ)練習(xí)題。

當(dāng)前文章:java汽車售票系統(tǒng)代碼 java汽車售票系統(tǒng)代碼查詢
文章源于:http://www.muchs.cn/article30/dohidso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、自適應(yīng)網(wǎng)站服務(wù)器托管、云服務(wù)器、網(wǎng)站排名微信公眾號(hào)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營