c#_工大租车小系统
本代码主要用类的基本操作,涉及类的继承,构造,属性等
类的代码
car.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace 汽车租赁
{class car //车主类,基类{private string name; //车名private int xuhao; //车序号private double price; //车一辆,一天的的价格 private int days = 0; //粗车天数,默认0 private int number = 0; //租车数量,默认为0 public string Name{get { return name; }set { name = value; }}public int Xuhao{get { return xuhao; }set { xuhao = value; }}public double Price{get { return price; }set { price = value; }}public int Days{get { return days; }set { days = value; }}public int Number{get { return number; }set { number = value; }}public double zj(){return (this.price * this.number * this.days);}}class GoodsCar : car //载货车,继承Car{public int weight;//每辆车每次载重public int zz() //该种车总载重{return (this.Number * this.weight * this.Days);}}class PeopleCar : car{public int people; //每辆车载人数public int zr(){return (this.Number * this.people * this.Days);}}class GoodsAndPeopleCar : car //皮卡车(载人拉货){public int weight;public int people;public GoodsAndPeopleCar(int days, int number) //构造{this.Xuhao = 3;this.Name = "皮卡雪6";this.Price = 450;this.weight = 2;this.people = 4;this.Days = days;this.Number = number;}public void toString() //输出{Console.WriteLine("{0} {1} {2}辆 {3} 租金{4}元 {5}坐 {6}吨 一共{7}元 ",this.Xuhao, this.Name,this.Number , this.Days, this.Price, this.people, this.weight, (this.Days * this.Price*this.Number ));}public int zz(){return (this.Number * this.weight * this.Days);}public int zr(){return (this.Number *this.people *this.Days );}}class SongHuaJiangGoodsCar :GoodsCar //松花江货车{public SongHuaJiangGoodsCar(int days, int number){this.Xuhao = 5;this.Name = "松花江";this.Price = 400;this.weight = 4;this.Days = days;this.Number = number;}public void toString(){Console.WriteLine("{0} {1} {2}辆 {3} 租金{4}元 装载货物{5}吨 一共{6}元 ",this.Xuhao, this.Name,this.Number , this.Days, this.Price, this.weight, (this.Days * this.Price*this.Number ));}}class YiWeiKeGoodsCar : GoodsCar{public YiWeiKeGoodsCar(int days, int number){this.Xuhao = 6;this.Name = "依维柯";this.Price = 1000;this.weight = 20;this.Days = days;this.Number = number;}public void toString(){Console.WriteLine("{0} {1} {2}辆 {3} 租金{4}元 装载货物{5}吨 一共{6}元 ",this.Xuhao, this.Name, this.Number, this.Days, this.Price, this.weight, (this.Days * this.Price * this.Number));}}class AoDiA4PeopleCar : PeopleCar {public AoDiA4PeopleCar(int days, int number){this.Xuhao = 1;this.Name = "奥迪A4";this.Price = 500;this.people = 4;this.Days = days;this.Number = number;}public void toString(){Console.WriteLine("{0} {1} {2}辆 {3} 租金{4}元 装载货物{5}吨 一共{6}元 ",this.Xuhao,this.Name, this.Number, this.Days, this.Price, this.people, (this.Days * this.Price * this.Number));}}class MaZiDa6PeopleCar : PeopleCar{public MaZiDa6PeopleCar(int days, int number){this.Xuhao = 2;this.Name = "马自达6";this.Price = 400;this.people = 4;this.Days = days;this.Number = number;}public void toString(){Console.WriteLine("{0} {1} {2}辆 {3} 租金{4}元 装载货物{5}吨 一共{6}元 ",this.Xuhao, this.Name, this.Number, this.Days, this.Price, this.people, (this.Days * this.Price * this.Number));}}class JinLongPeopleCar : PeopleCar{public JinLongPeopleCar(int days, int number){this.Xuhao = 4;this.Name = "金 龙";this.Price = 800;this.people = 20;this.Days = days;this.Number = number;}public void toString(){Console.WriteLine("{0} {1} {2}辆 {3} 租金{4}元 装载货物{5}吨 一共{6}元 ",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 汽车租赁
{class Program{static void Main(string[] args){AoDiA4PeopleCar aodi = new AoDiA4PeopleCar(0,0);MaZiDa6PeopleCar mazi = new MaZiDa6PeopleCar(0,0);GoodsAndPeopleCar gope = new GoodsAndPeopleCar(0,0);JinLongPeopleCar jinlong = new JinLongPeopleCar(0,0);SongHuaJiangGoodsCar songh = new SongHuaJiangGoodsCar(0,0);YiWeiKeGoodsCar yiwe = new YiWeiKeGoodsCar(0,0);Console.WriteLine("\t\t欢迎使用安工大租车系统!\n");Console.WriteLine("==============================================");Console.WriteLine("您是否要租车:(1是0否)");int a = Convert.ToInt32(Console .ReadLine ());if (a == 1){Console.WriteLine("您可租车的类型及其价目表:");Console.WriteLine(" 序号\t 汽车名称\t 租金/天 \t 容量");Console.WriteLine(" 1 \t 奥迪A4 \t 500元 \t 载人:4人");Console.WriteLine(" 2 \t 马自达6 \t 400元 \t 载人:4人");Console.WriteLine(" 3 \t 皮卡雪6 \t 450元 \t 载人:4人,载货:2吨");Console.WriteLine(" 4 \t 金龙 \t 800元 \t 载人:20人");Console.WriteLine(" 5 \t 松花江 \t 400元 \t 载货:4吨");Console.WriteLine(" 6 \t 依维柯 \t 1000元 \t 载货:20吨");Console.WriteLine("请输入您要几种类型的车:");int m = Convert.ToInt32(Console .ReadLine ());int[,] xingxi = new int[m,3]; //保存租车信息(序号、车辆数、租用天数)for (int i = 0; i < m; i++){Console.WriteLine("请输入第{0}俩车的信息:(序号、车辆数、租用天数)",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++){switch (xingxi[i, 0]){case 1:aodi = new AoDiA4PeopleCar(xingxi[i,2],xingxi[i,1]);break;case 2:mazi = new MaZiDa6PeopleCar (xingxi[i, 2], xingxi[i, 1]);break;case 3:gope = new GoodsAndPeopleCar (xingxi[i, 2], xingxi[i, 1]);break;case 4:jinlong = new JinLongPeopleCar (xingxi[i, 2], xingxi[i, 1]);break;case 5:songh = new SongHuaJiangGoodsCar (xingxi[i, 2], xingxi[i, 1]);break;case 6:yiwe = new YiWeiKeGoodsCar (xingxi[i, 2], xingxi[i, 1]);break;default:Console.WriteLine("选车序号有误");break;}}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一共可以坐{0}人,载重{1}吨",(aodi.zr() + mazi.zr() + gope.zr() + jinlong.zr()), (gope.zz() + songh.zz() + yiwe.zz()));Console.WriteLine("一共花费的钱为:{0}元 !", aodi.zj() + mazi.zj() + gope.zj() + jinlong.zj() + songh.zj() + yiwe.zj());}else{Console.WriteLine("欢迎光顾工大租车系统!欢迎下次再来!告辞!!!");}Console.Read();}}
}
c#_工大租车小系统相关推荐
- java小项目租车系统_Java小作业--嘻嘻租车小系统
Java作业–租车小系统 项目介绍: 根据所学知识,编写一个控制台版的"嘻嘻租车系统" 功能: 展示所有可租车辆 选择车型.租车天数 展示租车清单,包括:总金额.总载货量及其车型 ...
- python租车系统_使用Python实现租车计费系统的两种方法
您的位置:首页 > 站长学院 > 网络技术 正文内容 使用Python实现租车计费系统的两种方法 使用Python实现租车计费系统的两种方法 更新时间:2018-09-29 18:0 ...
- python出租车计费标准_使用Python实现租车计费系统的两种方法
要求: #出租车计费************************************************************************************** # 要 ...
- 租车小程序系统开发制作功能介绍
租车小程序一站式线上预约租车系统.针对租车行业量身定制,集预约.电子合同.客户认证.取还车.售后续租于一体低成本自建租车系统,无平台抽佣,降低人工与运营成本. 汽车租赁出租小程序主要功能有: 出租车辆 ...
- 租车小程序开发的必备功能
租车行业对于普通的受众群体来说,可能用的不多,但,对于经常出差,或者远行以及需要代步工具的人对说,这就是必须的,同时去哪儿租车也是一个很大的问题,如果是在几年前,想要租台车,那绝对算是个麻烦的事情.但 ...
- php租车小程序源码[附小程序图文详解]
租车小程序开发的功能有哪些?汽车租赁小程序开发方案详解. 一 用户小程序端 1.登录/注册 租车小程序开发提供在线注册功能.用户注册个人账户后,可以在线浏览, 2.汽车类型的选择 汽车品牌和车型很多, ...
- 基于ssm框架的汽车租赁租车行系统
汽车租赁租车行系统采用ssm框架和java中流行的MVC三层设计模式和eclipse编辑器.MySQL数据库设计并实现的 .本汽车租赁管理系统主要包括系统用户管理模块.站内新闻管理模块.车辆信息管理. ...
- java代码审计ssrf危险函数_某租车系统Java代码审计之后台注入漏洞分析
CMS简介 系统基于租车业务场景而搭建的O2O服务平台,可为用户提供商务租车.接送机.旅游租车.企业租车.自驾租车.婚庆用车等自助租车服务. 系统包含车辆库管理.门店管理.员工管理.司机管理.订单管理 ...
- 基于微信汽车租赁租车小程序系统设计与实现 开题报告
毕业论文 基于微信小程序租车系统 开题报告 学 院: 专 业: 年 级: 学生姓名: 指导教师: 黄菊华 XXXX大学本科生毕业论文(设计)开题报告书 姓 名 Xxx 学 ...
- 租车小程序系统源码+保险+押金+区域限制
该汽车租赁小程序系统基于W7开发,简化了各种小程序开发的流程,企业无需考虑太多,只需要缴纳费用,坐等小程序上架即可,从中不嫩看出,其优点在于轻松方便.租赁类型微信小程序与定制类的小程序相比,在费用方面 ...
最新文章
- Hibernate学习(九)———— 二级缓存和事务级别详讲
- 介绍并扩展Fitnesse的测试模块化机制:Scenario
- MATLAB 基本数据类型和调用方式
- Little Sub and Applese
- CodeForces - 1312C Adding Powers(思维+位运算)
- NYOJ题目611练练
- Windows 2003 上使用 Windows Live Writer
- linux如何安装php,Linux下如何安装配置PHP
- 用K2设计一个工作流程
- bzoj 1016: [JSOI2008]最小生成树计数
- CentOS7---iptables
- iis支持java吗_如何让iis支持jsp,servlet
- Mac触控板Magic Trackpad的常用手势
- QT重写QLabel画框并透明化背景
- python基础-猜数字游戏
- recovery.img 的解包与打包
- JAVA电商 B2B2C商城系统 多用户商城系统 直播带货 新零售商城 o2o商城 电子商务 拼团商城 分销商城 直播商城 短视频商城 springcloud商城 spring cloud商城
- 你连基础的JVM运行时内存布局都忘了?Java面试题及解析
- 微信小程序开发多少钱 怎么看价格成本
- 虚拟麦克风音频输入_塑电竞强音 为专业而声 全新职业级罗技G PRO X游戏耳机麦克风震撼上市...
热门文章
- 斐波那契数列_详解(C语言)
- IV-18(前苏联ИВ-18)荧光管电子钟【Energy Pillar.能量柱】
- 网关、路由器、交换机
- 【历史上的今天】10 月 17 日:微软发布 Windows 8.1;IMDb 成立;海盗湾创始人诞生
- linux 下部署tomcat问题
- c语言设计程序计算水仙花数,C语言水仙花数算法
- android mmdd 时间问题
- $(this).bind(change,itemno_change);
- CCNA(七)思科路由器基本配置
- tc2 怎么编写c语言6,WinTC.EXE:TC for Windows (TC2 C语言编译器)