网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

汽车买票系统java代码 java编程火车购票系统代码

毕业设计java做的网站订票系统要交可执行程序怎么交?

将Java程序打包成exe可执行文件

创新互联建站成立与2013年,公司以网站制作、成都网站制作、系统开发、网络推广、文化传媒、企业宣传、平面广告设计等为主要业务,适用行业近百种。服务企业客户近千家,涉及国内多个省份客户。拥有多年网站建设开发经验。为企业提供专业的网站建设、创意设计、宣传推广等服务。 通过专业的设计、独特的风格,为不同客户提供各种风格的特色服务。

第一步:将Java程序通过Eclipse或者JRE导出成Jar包;

第二步:通过exe4j将Jar包程序生成exe可执行文件。

作为毕业设计,要求你交执行程序肯定是有办法实现的啊,当然你也可以用脚本执行,不过既然要交源码,都到这里了打包成exe也就用不了什么时间了

Java编写汽车类car

public class Car {

private int num;//编号

private String name;//型号

private double price;//单价

/**

 * 无参构造

 */

public Car(){

super();

}

/**

 * 有参构造

 * @param num

 * @param name

 * @param price

 */

public Car(int num, String name, double price) {

super();

this.num = num;

this.name = name;

this.price = price;

}

public int getNum() {

return num;

}

public void setNum(int num) {

this.num = num;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

public String inforShow() {

return "Car [num=" + num + ", name=" + name + ", price=" + price + "]";

}

}

public class PriCar extends Car{

private int PersonNum;//最大载客量

public PriCar(int personNum) {

super();

PersonNum = personNum;

}

public PriCar() {

super();

}

public int getPersonNum() {

return PersonNum;

}

public void setPersonNum(int personNum) {

PersonNum = personNum;

}

@Override

public String inforShow() {

return "PriCar [PersonNum=" + PersonNum + "]";

}

}

public class VanCar extends Car {

private double weight;//最大载重

public VanCar(double weight) {

super();

this.weight = weight;

}

public VanCar() {

super();

}

@Override

public String inforShow() {

return "PriCar  [num=" + super.getNum() + ", name=" + super.getName() + ", price=" + super.getPrice() +",weight=" + weight + "]";

}

}

测试类不想写了  应该可以自己写出来了吧

初学者请求java源代码

class Car

{

// 车辆属性

private String brand; // 品牌

private double engineDisplacement;// 排气量

private double speed;// 当前速度

private boolean status;// 启动状态

private double maxSpeed;// 最大速度

public double getSpeed () {

return this.speed;

}

public Car(String brand, double engineDisplacement, double maxSpeed) {

this.brand = brand;

this.engineDisplacement = engineDisplacement;

this.maxSpeed = maxSpeed;

// 其他属性也要有初始值,不然执行出错。

this.speed = 0;

this.status = false;

}

/** 启动 */

public void start() {

this.status = true;

printNowStatus ();

}

/** 关闭(熄火) */

public void stop() {

// 只在速度为0时关闭(貌似楼上两位没仔细看题…)

if (this.speed == 0)

{

this.status = false;

}

printNowStatus ();

}

/** 加速 */

public void speedUp() {

// 只在启动时可以加速

if (this.status)

{

this.speed = this.speed + 20;

if (this.speed this.maxSpeed)

{

this.speed = this.maxSpeed;

}

}

printNowStatus ();

}

/** 减速 */

public void slowDown() {

// 只在启动时可以减速

if (this.status)

{

this.speed = this.speed - 10;

if (this.speed 0)

{

this.speed = 0;

}

}

printNowStatus ();

}

/** 状态打印,在每次启动,加减速,关闭时调用 */

private void printNowStatus () {

System.out.println("轿车【" + this.brand + "】现在的启动状态是:" + this.status + "速度是:" + this.speed +"。");

}

}

public class TestCar

{

public static void main(String[] args)

{

Car myCar = new Car ("红旗", 2, 120);

//启动

myCar.start();

// 循环加速到120

while (myCar.getSpeed() 120)

{

myCar.speedUp();

}

//循环减速

while (myCar.getSpeed() 0)

{

myCar.slowDown();

}

//关闭

myCar.stop();

}

}

/* 直接拿文本写的,我用的电脑没装jdk,楼主自己到Java开发环境下调试,应该没什么问题… */

请问如何用Java编写一个汽车类Car

public class Car {

private String color;//颜色

private int door;//车门数量

private float speed;//车速

public Car(){

this.color = "红色";

this.door = 3;

this.speed = 110;

}

public Car(String color, int door, float speed) {

this.color = color;

this.door = door;

this.speed = speed;

}

public void start(){

//汽车启动。输出汽车已启动,并输出汽车的各个属性

System.out.println("汽车已启动,汽车颜色为"+color+",车门数为"+door+",车速为"+speed);

}

public void speedUp(float speed){

//加速

System.out.println("汽车加速到"+speed+"km/h");

}

public void shutDown(float speed){

//减速

System.out.println("汽车减速到"+speed+"km/h");

}

public void brake(){

//刹车

System.out.println("已刹车");

}

}

public class Test {

public static void main(String[] args){

Car car = new Car();

car.start();

car.speedUp(100);

car.shutDown(60);

car.brake();

Car car1 = new Car("白色",4,20.2F);

car1.start();

car1.speedUp(100);

car1.shutDown(60);

car1.brake();

}

}

运行结果

java编写火车售票系统

你说的这个程序应该是不难的,只不过N久没有写过javaswing 了

还有就是java没有多继承的,只有多实现接口的

继承的关键字是:extends

接口的关键字是:interface

急~~高手请告诉我如何编写小汽车的java程序代码??重赏!

import java.lang.*;

class Car{

public void safe(){

System.out.println("an quan xi shu gao !");

}

}

class Benz extends Car{

public void safe(){

System.out.println("che hao !");

}

}

class Santana extends Car{

public void safe(){

System.out.println("che hen bu hao hao !");

}

}

public class Test{

public static void main(String[]args){

Car s = new Car();

s.safe();

Benz s1 = new Benz();

s1.safe();

Santana s2 = new Santana();

s2.safe();

Car s3 = new Benz();

s3.safe();

Car s4 = new Santana();

s4.safe();

}

}

这是一个 命名为Test.java

public class Car{

double price;

String name;

int id;

//3个重载的构造方法(name)(id,name)(id,name,price)

public Car(String name){

this(789,name);

}

public Car(int id,String name){

this(id,name,100000);

}

protected Car(int id,String name,double price){

this.price = price;

this.name = name;

this.id = id;

}

//3个重载的普通方法drive(int) drive(String) drive(int ,String)

public void drive(int i){

System.out.println("i = " + i);

System.out.println(price + "\n" + name + "\n" + id);

}

protected String drive(String s){

return "s is: " + s;

}

int drive(int i,String s){

return 2007;

}

}

class Test{

public static void main(String[]args){

Car c1 = new Car(777,"Santana");

c1.drive(18);

}

}

这个命名为Car.java

希望有你要的!


网页题目:汽车买票系统java代码 java编程火车购票系统代码
标题来源:http://bjjierui.cn/article/dooiids.html

其他资讯