当前位置: 首页 > news >正文

网站后台系统功能哈尔滨快照优化

网站后台系统功能,哈尔滨快照优化,wordpress cdn ssl证书,广西建设厅官网证件查询目的#xff1a; 设计一个简单的汽车租赁系统#xff0c;包含以下功能#xff1a; 添加车辆#xff1a;用户可以添加新的车辆到系统中#xff0c;包括车辆的品牌、型号、车牌号、日租金等信息。查找车辆#xff1a;用户可以通过车牌号或者品牌来查找车辆#xff0c;并…目的 设计一个简单的汽车租赁系统包含以下功能 添加车辆用户可以添加新的车辆到系统中包括车辆的品牌、型号、车牌号、日租金等信息。查找车辆用户可以通过车牌号或者品牌来查找车辆并显示该车辆的租赁信息。租车用户可以根据车辆的品牌和租赁天数来租车系统会计算租车的费用。归还车辆用户可以归还已租赁的车辆系统会更新车辆的租赁状态并计算租金。 分析 使用面向对象的方式实现包括至少两个类例如 Car 和 CarRentalSystem。使用合适的数据结构例如列表来存储车辆信息和租赁记录。提供命令行界面不需要图形用户界面。 实现 car类 using System;public class Car {public string Brand { get; set; }public string Model { get; set; }public string LicensePlate { get; set; }public decimal DailyRent { get; set; }public bool IsRented { get; set; }public Car(string brand, string model, string licensePlate, decimal dailyRent){Brand brand;Model model;LicensePlate licensePlate;DailyRent dailyRent;IsRented false;}public override string ToString(){return $Brand: {Brand}, Model: {Model}, License Plate: {LicensePlate}, Daily Rent: {DailyRent:C}, Status: {(IsRented ? Rented : Available)};} }CarRentalSystem 类 using System; using System.Collections.Generic; using System.Linq;public class CarRentalSystem {private ListCar cars;public CarRentalSystem(){cars new ListCar();}public void AddCar(string brand, string model, string licensePlate, decimal dailyRent){cars.Add(new Car(brand, model, licensePlate, dailyRent));Console.WriteLine(Car added successfully.);}public void FindCar(string searchCriteria){var foundCars cars.Where(car car.LicensePlate.Contains(searchCriteria) || car.Brand.Contains(searchCriteria)).ToList();if (foundCars.Count 0){foreach (var car in foundCars){Console.WriteLine(car);}}else{Console.WriteLine(No cars found.);}}public void RentCar(string brand, int days){var availableCar cars.FirstOrDefault(car car.Brand brand !car.IsRented);if (availableCar ! null){availableCar.IsRented true;decimal totalCost availableCar.DailyRent * days;Console.WriteLine($Car rented successfully. Total cost: {totalCost:C});}else{Console.WriteLine(No available cars found for the specified brand.);}}public void ReturnCar(string licensePlate){var rentedCar cars.FirstOrDefault(car car.LicensePlate licensePlate car.IsRented);if (rentedCar ! null){rentedCar.IsRented false;Console.WriteLine(Car returned successfully.);}else{Console.WriteLine(Car not found or already returned.);}} }主程序 using System;public class Program {public static void Main(){CarRentalSystem carRentalSystem new CarRentalSystem();while (true){Console.WriteLine(\nCar Rental System);Console.WriteLine(1. Add Car);Console.WriteLine(2. Find Car);Console.WriteLine(3. Rent Car);Console.WriteLine(4. Return Car);Console.WriteLine(5. Exit);Console.Write(Enter your choice: );string choice Console.ReadLine();switch (choice){case 1:Console.Write(Enter brand: );string brand Console.ReadLine();Console.Write(Enter model: );string model Console.ReadLine();Console.Write(Enter license plate: );string licensePlate Console.ReadLine();Console.Write(Enter daily rent: );decimal dailyRent decimal.Parse(Console.ReadLine());carRentalSystem.AddCar(brand, model, licensePlate, dailyRent);break;case 2:Console.Write(Enter license plate or brand to search: );string searchCriteria Console.ReadLine();carRentalSystem.FindCar(searchCriteria);break;case 3:Console.Write(Enter brand to rent: );string rentBrand Console.ReadLine();Console.Write(Enter number of days: );int days int.Parse(Console.ReadLine());carRentalSystem.RentCar(rentBrand, days);break;case 4:Console.Write(Enter license plate to return: );string returnLicensePlate Console.ReadLine();carRentalSystem.ReturnCar(returnLicensePlate);break;case 5:return;default:Console.WriteLine(Invalid choice. Please try again.);break;}}} }完整代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace windows期末text1 {public class Car{public string Brand { get; set; }public string Model { get; set; }public string LicensePlate { get; set; }public decimal DailyRent { get; set; }public bool IsRented { get; set; }public Car(string brand, string model, string licensePlate, decimal dailyRent){Brand brand;Model model;LicensePlate licensePlate;DailyRent dailyRent;IsRented false;}public override string ToString(){return $Brand: {Brand}, Model: {Model}, License Plate: {LicensePlate}, Daily Rent: {DailyRent:C}, Status: {(IsRented ? Rented : Available)};}}public class CarRentalSystem{private ListCar cars;public CarRentalSystem(){cars new ListCar();}public void AddCar(string brand, string model, string licensePlate, decimal dailyRent){cars.Add(new Car(brand, model, licensePlate, dailyRent));Console.WriteLine(Car added successfully.);}public void FindCar(string searchCriteria){var foundCars cars.Where(car car.LicensePlate.Contains(searchCriteria) || car.Brand.Contains(searchCriteria)).ToList();if (foundCars.Count 0){foreach (var car in foundCars){Console.WriteLine(car);}}else{Console.WriteLine(No cars found.);}}public void RentCar(string brand, int days){var availableCar cars.FirstOrDefault(car car.Brand brand !car.IsRented);if (availableCar ! null){availableCar.IsRented true;decimal totalCost availableCar.DailyRent * days;Console.WriteLine($Car rented successfully. Total cost: {totalCost:C});}else{Console.WriteLine(No available cars found for the specified brand.);}}public void ReturnCar(string licensePlate){var rentedCar cars.FirstOrDefault(car car.LicensePlate licensePlate car.IsRented);if (rentedCar ! null){rentedCar.IsRented false;Console.WriteLine(Car returned successfully.);}else{Console.WriteLine(Car not found or already returned.);}}}internal class Program{static void Main(string[] args){CarRentalSystem carRentalSystem new CarRentalSystem();while (true){Console.WriteLine(\nCar Rental System);Console.WriteLine(1. Add Car);Console.WriteLine(2. Find Car);Console.WriteLine(3. Rent Car);Console.WriteLine(4. Return Car);Console.WriteLine(5. Exit);Console.Write(Enter your choice: );string choice Console.ReadLine();switch (choice){case 1:Console.Write(Enter brand: );string brand Console.ReadLine();Console.Write(Enter model: );string model Console.ReadLine();Console.Write(Enter license plate: );string licensePlate Console.ReadLine();Console.Write(Enter daily rent: );decimal dailyRent decimal.Parse(Console.ReadLine());carRentalSystem.AddCar(brand, model, licensePlate, dailyRent);break;case 2:Console.Write(Enter license plate or brand to search: );string searchCriteria Console.ReadLine();carRentalSystem.FindCar(searchCriteria);break;case 3:Console.Write(Enter brand to rent: );string rentBrand Console.ReadLine();Console.Write(Enter number of days: );int days int.Parse(Console.ReadLine());carRentalSystem.RentCar(rentBrand, days);break;case 4:Console.Write(Enter license plate to return: );string returnLicensePlate Console.ReadLine();carRentalSystem.ReturnCar(returnLicensePlate);break;case 5:return;default:Console.WriteLine(Invalid choice. Please try again.);break;}}}} } 实现结果 以上就是完整的代码及实现。 实验小结 通过此次实验掌握了以下知识和技能 面向对象编程的基本概念包括类和对象的使用。使用列表存储和管理数据。实现类的方法以完成特定功能。设计和实现简单的命令行用户界面。编写和调试C#程序。 重难点分析 重点 面向对象编程概念 理解类和对象的概念以及如何定义类的属性和方法。掌握构造函数的使用初始化对象时设置初始值。 列表数据结构 使用列表存储多个对象。熟练掌握列表的添加、查找和遍历操作。 方法的实现 编写方法实现特定功能例如添加车辆、查找车辆、租车和归还车辆。在方法中处理数据并进行必要的计算例如租车费用的计算。 难点 查找和筛选 如何高效地在列表中查找符合特定条件的对象。使用 LINQ 提高查找和筛选操作的效率和代码可读性。 状态管理 正确管理车辆的租赁状态避免出现状态不一致的情况。归还车辆时确保车辆状态更新正确。 用户输入处理 处理用户输入的有效性例如租赁天数应为正整数日租金应为正数。提供适当的错误提示和输入提示提高用户体验。 实验报告 实验名称 汽车租赁系统设计与实现 实验目的 通过设计和实现一个简单的汽车租赁系统掌握C#面向对象编程的基本知识熟悉类和对象的使用、列表数据结构的操作以及简单的命令行界面设计。 实验内容 设计并实现 Car 类用于表示车辆的基本信息。设计并实现 CarRentalSystem 类用于管理车辆的添加、查找、租赁和归还功能。实现一个简单的命令行界面让用户可以与系统进行交互。 实验环境 操作系统Windows 11编程语言C#开发工具Visual Studio 2022 实验步骤 设计 Car 类 创建一个新类 Car包含品牌、型号、车牌号、日租金和租赁状态等属性。实现 Car 类的构造函数用于初始化车辆信息。重写 ToString 方法用于输出车辆信息。 设计 CarRentalSystem 类 创建一个新类 CarRentalSystem使用列表存储车辆信息。实现添加车辆、查找车辆、租车和归还车辆的方法。在添加车辆方法中将新车辆添加到列表中。在查找车辆方法中根据车牌号或品牌查找并输出车辆信息。在租车方法中根据品牌查找可用车辆并计算租赁费用。在归还车辆方法中根据车牌号查找已租赁的车辆并更新其租赁状态。 实现命令行界面 编写主程序通过命令行界面与用户进行交互。提供菜单选项让用户可以选择不同的操作。根据用户的选择调用相应的方法完成相应的功能。
http://www.pierceye.com/news/32589/

相关文章:

  • 高埗做网站wordpress the7下载
  • 常德网站优化推广wordpress网页聊天工具
  • 网站模板 chinazwordpress app 接口
  • 房产网站做那个比较好腾讯企业邮箱域名格式
  • flash企业网站淄博网站公司电话
  • 有哪些做平面设计好的网站有哪些内容莱芜网络公司
  • 做网站下载什么软件网站建设大量定制阶段
  • 做外贸网站设计上需要注意什么中国建筑工业出版社
  • 建设网站如果赚钱网站设计配色方案
  • 中石化第四建设公司 网站Wordpress插件完全删除
  • 有没有做海报的网站推荐交易所网站建设教程
  • 免费建站网站排名建设网站用户名
  • 郑州网站建设与设计网站后台怎样批量上传
  • 别人在百度冒用公司旗号做网站门户网站开发 项目实施方案
  • 国外 平面设计 网站舟山企业网站建设
  • 社团建设制作网站费用会计科目湛江高端网站开发
  • 江苏省建设教育协会网站首页做黑网站
  • 在网站做推广要钱吗网络运营者
  • 大学生创新创业网站建设申报书网站建设实施计划包括
  • 呼伦贝尔市住房和城乡建设局网站桥头镇做网站
  • 小网站源码明光网站
  • 蓝色网站配色方案网站做好了怎么和域名
  • 大理建设学校官方网站wordpress禁用用户名
  • 石家庄网站优化招聘定制网站费用
  • 微信网站在线登录网页版大连网站建设谁家好
  • 南京浦口住房与城乡建设局网站哪些分类网站
  • 内江规划建设教育培训中心网站珠海互联网推广
  • 网站建设好学么网页设计发展前景分析
  • 教育类网站素材班级网站建设方案书
  • 厦门三五互联可以做网站吗中铁建设集团有限公司待遇