⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gasdata.java

📁 Vehicle Maintenance Tracker (VMT) 可以对多个车辆的维护进行跟踪。项目类似于Auto-Do-It
💻 JAVA
字号:
package jMaint;import java.util.*;public class GasData {    Vector date,veh,odo,amt,cost,oct,vend,com,tank,est;    public GasData() {        date = new Vector();        veh = new Vector();        odo = new Vector();        amt = new Vector();        cost = new Vector();        oct = new Vector();        vend = new Vector();        com = new Vector();        tank = new Vector();        est = new Vector();    }    public void addRecord(String Date,int VehicleID,int Odometer,float Amount,float Cost,int Octane,int VendorID,String Comment,String FullTank,String Estimated) {        this.date.addElement(new String(Date));        this.veh.addElement(new Integer(VehicleID));        this.odo.addElement(new Integer(Odometer));        this.amt.addElement(new Float(Amount));        this.cost.addElement(new Float(Cost));        this.oct.addElement(new Integer(Octane));        this.vend.addElement(new Integer(VendorID));        this.com.addElement(new String(Comment));        this.tank.addElement(new String(FullTank));        this.est.addElement(new String(Estimated));    }    public void deleteRecord(int x) {        this.date.removeElementAt(x);        this.veh.removeElementAt(x);        this.odo.removeElementAt(x);        this.amt.removeElementAt(x);        this.cost.removeElementAt(x);        this.oct.removeElementAt(x);        this.vend.removeElementAt(x);        this.com.removeElementAt(x);        this.tank.removeElementAt(x);        this.est.removeElementAt(x);    }    public String exportRecord(int x) {        String t = String.valueOf('\t');        String nl = String.valueOf('\n');        String a = "T";        if (!this.getTank(x))            a = "F";        String e = "F";        if (this.getEstimated(x))            e = "T";        return this.getDate(x)+t+this.getVehicleID(x)+t+this.getOdometer(x)+t+this.getAmount(x)+t+this.getCost(x)+t+this.getOctane(x)+t+this.getVendorID(x)+t+this.getComment(x)+t+a+t+e+nl;    }    public float getAmount(int x) {        return Float.parseFloat(this.amt.get(x).toString());    }    public String getComment(int x) {        return this.com.get(x).toString();    }    public float getCost(int x) {        return Float.parseFloat(this.cost.get(x).toString());    }    public String getDate(int x) {        return this.date.get(x).toString();    }    public boolean getEstimated(int x) {        boolean y = true;        if (this.est.get(x).toString().equalsIgnoreCase("F"))            y = false;        return y;    }    public int getOctane(int x) {        return Integer.parseInt(this.oct.get(x).toString());    }    public int getOdometer(int x) {        return Integer.parseInt(this.odo.get(x).toString());    }    public boolean getTank(int x) {        boolean y = true;        if (this.tank.get(x).toString().equalsIgnoreCase("F"))            y = false;        return y;    }    public int getVehicleID(int x) {        return Integer.parseInt(this.veh.get(x).toString());    }    public int getVendorID(int x) {        return Integer.parseInt(this.vend.get(x).toString());    }    public int indexOf(int Odometer) {        int y = -1;        for (int i=0; i<this.size(); i++)            if (this.odo.get(i).toString().equalsIgnoreCase(String.valueOf(Odometer)))                y=i;        return y;    }    public int indexVehStart(int VehicleID) {        return this.veh.indexOf(new Integer(VehicleID));    }    public int indexVehEnd(int VehicleID) {        return this.veh.lastIndexOf(new Integer(VehicleID));    }    public void insertRecord(String Date,int VehicleID,int Odometer,float Amount,float Cost,int Octane,int VendorID,String Comment,String FullTank,String Estimated) {        int i = this.indexVehStart(VehicleID);        while ((i<(this.indexVehEnd(VehicleID)+1)) && (this.getOdometer(i)>Odometer))            i++;//        if (this.odo.get(i).toString().equalsIgnoreCase(Integer.toString(Odometer)))//            this.deleteRecord(i);        this.date.insertElementAt(new String(Date), i);        this.veh.insertElementAt(new Integer(VehicleID), i);        this.odo.insertElementAt(new Integer(Odometer), i);        this.amt.insertElementAt(new Float(Amount), i);        this.cost.insertElementAt(new Float(Cost), i);        this.oct.insertElementAt(new Integer(Octane), i);        this.vend.insertElementAt(new Integer(VendorID), i);        this.com.insertElementAt(new String(Comment), i);        this.tank.insertElementAt(new String(FullTank), i);        this.est.insertElementAt(new String(Estimated), i);    }    public int size() {        return this.odo.size();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -