本**主要用類的基本操作,涉及類的繼承,構造,屬性等
類的**
car.cs
using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.threading.tasks;
namespace 汽車租賃
set
}public int xuhao
set
}public double price
set
}public int days
set
}public int number
set
}public double zj()
}class goodscar : car //載貨車,繼承car
}class peoplecar : car
}class goodsandpeoplecar : car //皮卡車(載人拉貨)
public void tostring() //輸出
輛 租金元 坐 噸 一共元 ",
this.xuhao, this.name,this.number , this.days, this.price, this.people, this.weight, (this.days * this.price*this.number ));
}public int zz()
public int zr()
}class songhuajianggoodscar :goodscar //松花江貨車
public void tostring()
輛 租金元 裝載貨物噸 一共元 ",
this.xuhao, this.name,this.number , this.days, this.price, this.weight, (this.days * this.price*this.number ));}}
class yiweikegoodscar : goodscar
public void tostring()
輛 租金元 裝載貨物噸 一共元 ",
this.xuhao, this.name, this.number, this.days, this.price, this.weight, (this.days * this.price * this.number));}}
class aodia4peoplecar : peoplecar
public void tostring()
輛 租金元 裝載貨物噸 一共元 ",
this.xuhao,this.name, this.number, this.days, this.price, this.people, (this.days * this.price * this.number));}}
class mazida6peoplecar : peoplecar
public void tostring()
輛 租金元 裝載貨物噸 一共元 ",
this.xuhao, this.name, this.number, this.days, this.price, this.people, (this.days * this.price * this.number));}}
class jinlongpeoplecar : peoplecar
public void tostring()
輛 租金元 裝載貨物噸 一共元 ",
this.xuhao, this.name, this.number, this.days, this.price, this.people, (this.days * this.price * this.number));}}
}
主函式program.cs
using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.threading.tasks;
namespace 汽車租賃
倆車的資訊:(序號、車輛數、租用天數)",i+1);
console.write("序號:");
xingxi[i, 0] = convert.toint32(console .readline ());
console.write("車輛數:");
xingxi[i, 1] = convert.toint32(console.readline());
console.write("租用天數:");
xingxi[i, 2] = convert.toint32(console.readline());
}for (int i = 0; i < m; i++)
}console.writeline("\n選車完畢,正在列印賬單\n");
console.writeline("\n\t\t賬單為:");
console.writeline("序號 名稱 車輛數 天數 租金/天 容量/車 金額/元");
aodi.tostring(); //呼叫輸出函式輸出型別
mazi.tostring();
gope.tostring();
jinlong.tostring();
songh.tostring();
yiwe.tostring();
console.writeline("\n一共可以坐人,載重噸",
(aodi.zr() + mazi.zr() + gope.zr() + jinlong.zr()), (gope.zz() + songh.zz() + yiwe.zz()));
console.writeline("一共花費的錢為:元 !", aodi.zj() + mazi.zj() + gope.zj() + jinlong.zj() + songh.zj() + yiwe.zj());
}else
console.read();}}
}
哈工大C語言程式設計精髓 計程車計價
題目內容 已知某城市普通計程車收費標準為 起步里程為3公里,起步費為8元,10公里以內超過起步里程的部分,每公里加收2元,超過10公里以上的部分加收50 的回空補貼費,即每公里3元。計程車營運過程中,因堵車和乘客要求臨時停車等客的,按每5分鐘加收2元 計算,不足5分鐘的不計費。從鍵盤任意輸入行駛里程...
C 實踐 租車管理系統
密碼檢測 public static bool check 3 count count 防止輸入累加 input string.empty secretinput ref input if input.equals password else car base.cs using system nam...
FPGA最小系統
專案分享 自製fpga最小系統板 pcb可直接打板 用一顆 很小的fpga fpga開發板剁手,學生狗省錢 丨 資源 賽靈思的zynq器件由其vivado高階綜合設計套件提供支援,包括雙核arm cortex a9,usb 2.0和千兆乙太網。除了zynq還有哪些內嵌arm硬核的fpga?xilin...