欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python實(shí)現(xiàn)停車(chē)場(chǎng)管理系統(tǒng)

 更新時(shí)間:2022年06月02日 14:12:00   作者:若如初見(jiàn)kk  
這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)停車(chē)場(chǎng)管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了python實(shí)現(xiàn)停車(chē)場(chǎng)管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

一、需求

1、為一個(gè)車(chē)位數(shù)量固定的停車(chē)場(chǎng),設(shè)計(jì)一個(gè)管理系統(tǒng);
2、停車(chē)信息包括:編號(hào)、車(chē)牌號(hào)(若存在)、類(lèi)型、車(chē)位編號(hào)、使用日期、入場(chǎng)時(shí)間、單價(jià)、費(fèi)用、經(jīng)手人
3、停車(chē)信息存儲(chǔ)在數(shù)據(jù)文件中,程序至少實(shí)現(xiàn)功能:瀏覽、查詢(xún)、入場(chǎng)、出場(chǎng)、導(dǎo)出、計(jì)費(fèi)、系統(tǒng)菜單
4、按面向?qū)ο蟪绦蛟O(shè)計(jì)方法進(jìn)行類(lèi)的定義:選擇合適的數(shù)據(jù)存儲(chǔ)結(jié)構(gòu),并定義相應(yīng)的數(shù)據(jù)元素類(lèi),選擇合理的操作方法定義相應(yīng)的算法實(shí)現(xiàn)類(lèi)

二、代碼

本系統(tǒng)包含4部分(4個(gè)py文件,剩余為測(cè)試數(shù)據(jù)文件),組成放在一個(gè)文件夾組成一個(gè)模塊,如下圖。

2.1 初始化模塊__init__.py

"""
__init__.py 模塊的作用:在導(dǎo)入包的時(shí)候自動(dòng)執(zhí)行這里的代碼,進(jìn)行初始化工作
"""
# 允許被 from package_name import * 導(dǎo)入的模塊
__all__ = ['ParkingManagementSystem', 'Car']

2.2 主程序模塊main.py

# coding = utf-8

from ParkingManagementSystem import *
from Car import *


def main():
? ? # 創(chuàng)建停車(chē)信息管理系統(tǒng)對(duì)象
? ? p = ParkingManagementSystem()
? ? # 創(chuàng)建一個(gè)停車(chē)對(duì)象
? ? car = Car()
? ? while True:
? ? ? ? print("")
? ? ? ? print("******************* 歡迎進(jìn)入:停車(chē)場(chǎng)信息管理系統(tǒng) *******************")
? ? ? ? print("------------------------- 1.瀏覽所有信息 ------------------------")
? ? ? ? print("------------------------- 2.查詢(xún)車(chē)輛信息 ------------------------")
? ? ? ? print("------------------------- 3.入場(chǎng)車(chē)輛錄入 ------------------------")
? ? ? ? print("------------------------- 4.出場(chǎng)車(chē)輛刪除 ------------------------")
? ? ? ? print("------------------------- 5.退出管理系統(tǒng) ------------------------")
? ? ? ? try:
? ? ? ? ? ? # 接收輸入指令
? ? ? ? ? ? cmd = int(input("請(qǐng)輸入指令數(shù)字:"))
? ? ? ? ? ? # 1.瀏覽所有信息
? ? ? ? ? ? if cmd == 1:
? ? ? ? ? ? ? ? p.show_all_information()
? ? ? ? ? ? # 2.查詢(xún)車(chē)輛信息
? ? ? ? ? ? elif cmd == 2:
? ? ? ? ? ? ? ? while True:
? ? ? ? ? ? ? ? ? ? print("------ 1.按車(chē)牌號(hào)查找 ------")
? ? ? ? ? ? ? ? ? ? print("------ 2.按車(chē)類(lèi)型查找 ------")
? ? ? ? ? ? ? ? ? ? print("------ 3.按使用日期查找 -----")
? ? ? ? ? ? ? ? ? ? print("------ 4.按經(jīng)手人查找 ------")
? ? ? ? ? ? ? ? ? ? print("------ 5.查詢(xún)歷史記錄 ------")
? ? ? ? ? ? ? ? ? ? print("------ 6.返回上級(jí)菜單 ------")
? ? ? ? ? ? ? ? ? ? query = int(input("請(qǐng)輸入指令數(shù)字:"))
? ? ? ? ? ? ? ? ? ? # 1.按車(chē)牌號(hào)查找
? ? ? ? ? ? ? ? ? ? if query == 1:
? ? ? ? ? ? ? ? ? ? ? ? query_results = p.query_by_car_number()
? ? ? ? ? ? ? ? ? ? ? ? # 判定查詢(xún)結(jié)果是否為空(False),是則不保存
? ? ? ? ? ? ? ? ? ? ? ? if query_results:
? ? ? ? ? ? ? ? ? ? ? ? ? ? decide = input("是否需要保存查詢(xún)結(jié)果(輸入:yes/no):")
? ? ? ? ? ? ? ? ? ? ? ? ? ? if decide == "yes":
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p.save_query_results_to_file(query_results)
? ? ? ? ? ? ? ? ? ? # 2.按車(chē)類(lèi)型查找
? ? ? ? ? ? ? ? ? ? elif query == 2:
? ? ? ? ? ? ? ? ? ? ? ? query_results = p.query_by_car_type()
? ? ? ? ? ? ? ? ? ? ? ? # 判定查詢(xún)結(jié)果是否為空(False),是則不保存
? ? ? ? ? ? ? ? ? ? ? ? if query_results:
? ? ? ? ? ? ? ? ? ? ? ? ? ? decide = input("是否需要保存查詢(xún)結(jié)果(輸入:yes/no):")
? ? ? ? ? ? ? ? ? ? ? ? ? ? if decide == "yes":

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p.save_query_results_to_file(query_results)
? ? ? ? ? ? ? ? ? ? # 3.按使用日期查找
? ? ? ? ? ? ? ? ? ? elif query == 3:
? ? ? ? ? ? ? ? ? ? ? ? query_results = p.query_by_date()
? ? ? ? ? ? ? ? ? ? ? ? # 判定查詢(xún)結(jié)果是否為空(False),是則不保存
? ? ? ? ? ? ? ? ? ? ? ? if query_results:
? ? ? ? ? ? ? ? ? ? ? ? ? ? decide = input("是否需要保存查詢(xún)結(jié)果(輸入:yes/no):")
? ? ? ? ? ? ? ? ? ? ? ? ? ? if decide == "yes":
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p.save_query_results_to_file(query_results)
? ? ? ? ? ? ? ? ? ? # 4.按經(jīng)手人查找
? ? ? ? ? ? ? ? ? ? elif query == 4:
? ? ? ? ? ? ? ? ? ? ? ? query_results = p.query_by_handler()
? ? ? ? ? ? ? ? ? ? ? ? # 判定查詢(xún)結(jié)果是否為空(False),是則不保存
? ? ? ? ? ? ? ? ? ? ? ? if query_results:
? ? ? ? ? ? ? ? ? ? ? ? ? ? decide = input("是否需要保存查詢(xún)結(jié)果(輸入:yes/no):")
? ? ? ? ? ? ? ? ? ? ? ? ? ? if decide == "yes":
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p.save_query_results_to_file(query_results)
? ? ? ? ? ? ? ? ? ? # 5.查詢(xún)歷史記錄
? ? ? ? ? ? ? ? ? ? elif query == 5:
? ? ? ? ? ? ? ? ? ? ? ? p.query_history_results()
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? # 3.錄入車(chē)輛信息
? ? ? ? ? ? elif cmd == 3:
? ? ? ? ? ? ? ? # 接收停車(chē)車(chē)輛信息
? ? ? ? ? ? ? ? parking_info = car.get_parking_info()
? ? ? ? ? ? ? ? p.parking(parking_info)
? ? ? ? ? ? # 4.刪除車(chē)輛信息
? ? ? ? ? ? elif cmd == 4:
? ? ? ? ? ? ? ? p.driving_out()
? ? ? ? ? ? # 5.退出管理系統(tǒng)
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? # 保存停車(chē)信息的最大編號(hào) id
? ? ? ? ? ? ? ? car.save_id_to_file()
? ? ? ? ? ? ? ? print("感謝使用停車(chē)場(chǎng)管理系統(tǒng),再見(jiàn)!")
? ? ? ? ? ? ? ? break
? ? ? ? except Exception as result:
? ? ? ? ? ? # 保存停車(chē)信息的最大編號(hào) id
? ? ? ? ? ? car.save_id_to_file()
? ? ? ? ? ? # 保存停車(chē)信息
? ? ? ? ? ? p.save_to_file()
? ? ? ? ? ? print("感謝使用停車(chē)場(chǎng)管理系統(tǒng),再見(jiàn)!")
? ? ? ? ? ? break


if __name__ == "__main__":
? ? main()

2.3 停車(chē)管理模塊ParkingManagementSystem.py

# coding = utf-8
# 模塊中的__all__屬性:可以規(guī)定 模塊中 from module_name import * 只能夠?qū)氲囊恍╊?lèi)、變量、函數(shù)名
__all__ = ['ParkingManagementSystem']
import time


class ParkingManagementSystem(object):
? ? """算法實(shí)現(xiàn)類(lèi):停車(chē)場(chǎng)信息管理系統(tǒng)"""

? ? def __init__(self):
? ? ? ? """對(duì)停車(chē)信息進(jìn)行初始化"""
? ? ? ? # 測(cè)試時(shí)使用
? ? ? ? print("ParkingManagementSystem的__init__函數(shù)被調(diào)用")

? ? ? ? # 車(chē)位編號(hào)存放列表
? ? ? ? self.car_stall = []
? ? ? ? self.truck_stall = []
? ? ? ? # 所有停車(chē)信息存放列表
? ? ? ? self.total_info = []

? ? ? ? # 讀取停車(chē)場(chǎng)數(shù)據(jù)
? ? ? ? try:
? ? ? ? ? ? with open("parking_data.txt", "r") as file:
? ? ? ? ? ? ? ? for line in file.readlines():
? ? ? ? ? ? ? ? ? ? # 將字符串轉(zhuǎn)化為字典,遇到空行時(shí)跳過(guò),防止eval()函數(shù)轉(zhuǎn)化空行或者空字符時(shí)報(bào)錯(cuò)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? info_dict = eval(line)
? ? ? ? ? ? ? ? ? ? ? ? self.total_info.append(info_dict)
? ? ? ? ? ? ? ? ? ? ? ? if info_dict["car_type"] == "car":
? ? ? ? ? ? ? ? ? ? ? ? ? ? self.car_stall.append(info_dict["p_number"])
? ? ? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? ? ? self.truck_stall.append(info_dict["p_number"])
? ? ? ? ? ? ? ? ? ? except Exception as result:
? ? ? ? ? ? ? ? ? ? ? ? continue
? ? ? ? except Exception as result:
? ? ? ? ? ? print("停車(chē)信息數(shù)據(jù)文件不存在!")
? ? ? ? # 測(cè)試時(shí)使用
? ? ? ? # print(self.car_stall)
? ? ? ? # print(self.truck_stall)
? ? ? ? # print(self.total_info)

? ? def parking(self, parking_info):
? ? ? ? """入場(chǎng)停車(chē):傳入停車(chē)信息,在空的車(chē)位中增加車(chē)輛信息,更新數(shù)據(jù)文件"""
? ? ? ? # 判斷傳入停車(chē)信息是否為 None
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿牛顿M(fèi)咨詢(xún)
? ? ? ? passs

? ? def show_all_information(self):
? ? ? ? """輸出所有停車(chē)場(chǎng)信息,按車(chē)位使用情況分類(lèi),同一分類(lèi)中按編號(hào)升序排序"""
? ? ? ? # 初始化刷新數(shù)據(jù)
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿牛顿M(fèi)咨詢(xún)
? ? ? ? pass

? ? def query_by_car_number(self):
? ? ? ? """按車(chē)牌號(hào)查找停車(chē)信息"""
? ? ? ? # 接收車(chē)牌編號(hào)
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿?,付費(fèi)咨詢(xún)
? ? ? ? pass

? ? def query_by_car_type(self):
? ? ? ? """按車(chē)類(lèi)型查找停車(chē)信息"""
? ? ? ? # 接受車(chē)類(lèi)型
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿?,付費(fèi)咨詢(xún)
? ? ? ?pass

? ? def query_by_date(self):
? ? ? ? """按使用日期查找停車(chē)信息"""
? ? ? ? # 接收查詢(xún)?nèi)掌?
? ? ? ? date = input("請(qǐng)輸入查詢(xún)?nèi)掌冢ǜ袷絽⒖迹?998-06-06):")
? ? ? ? # 創(chuàng)建列表保存查詢(xún)結(jié)果
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿?,付費(fèi)咨詢(xún)
? ? ? ?pass

? ? def query_by_handler(self):
? ? ? ? """按經(jīng)手人查找停車(chē)信息"""
? ? ? ? # 接收經(jīng)手人姓名
? ? ? ? handler = input("請(qǐng)輸入經(jīng)手人姓名:")
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿?,付費(fèi)咨詢(xún)
? ? ? ? pass

? ? def query_history_results(self):
? ? ? ? """查詢(xún)停車(chē)場(chǎng)歷史記錄"""
? ? ? ? # 查詢(xún)輸入格式化
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿牛顿M(fèi)咨詢(xún)
? ? ? ? print("id ?car_type ?p_number ?car_number ? handler ? price ? ?cost ? ? entrance_time ? ? ? ? ? ?exit_time")
? ? ? ??

? ? def driving_out(self):
? ? ? ? """出場(chǎng):刪除對(duì)應(yīng)車(chē)位的車(chē)輛信息,更新數(shù)據(jù)文件"""
? ? ? ? # 接收出場(chǎng)時(shí)間
? ? ? ? exit_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
? ? ? ? # 接收車(chē)牌號(hào)
? ? ? ? car_number = input("請(qǐng)輸入出場(chǎng)車(chē)輛車(chē)牌號(hào)(示例:京A88888):")
? ? ? ? # 遍歷總停車(chē)信息列表,找到該條數(shù)據(jù)并將其移除列表
? ? ? ? pass

? ? def charging(self, info_dict):
? ? ? ? """計(jì)費(fèi): 傳入停車(chē)信息,按小時(shí)計(jì)費(fèi)"""
? ? ? ? # 接收車(chē)輛停車(chē)信息
? ? ? ? # 將時(shí)間由字符串格式轉(zhuǎn)化為數(shù)字格式,以秒為單位
? ? ? ? exit_time = time.mktime(time.strptime(info_dict["exit_time"], "%Y-%m-%d %H:%M:%S"))
? ? ? ? entrance_time = time.mktime(time.strptime(info_dict["entrance_time"], "%Y-%m-%d %H:%M:%S"))
? ? ? ? # 計(jì)算停車(chē)時(shí)間,單位轉(zhuǎn)化為小時(shí)
? ? ? ? pass

? ? def save_to_file(self):
? ? ? ? """將停車(chē)數(shù)據(jù)保存到文件"""
? ? ? ? # 打開(kāi)數(shù)據(jù)文件,保存數(shù)據(jù)
? ? ? ? with open("parking_data.txt", "w") as file:
? ? ? ? ? ? for info_dict in self.total_info:
? ? ? ? ? ? ? ? # 將字典轉(zhuǎn)化為字符串保存
? ? ? ? ? ? ? ? file.write(str(info_dict))
? ? ? ? ? ? ? ? file.write("\n")

? ? def save_history_to_file(self, info_dict):
? ? ? ? """將已完成出場(chǎng)停車(chē)數(shù)據(jù)保存到文件"""
? ? ? ? # 打開(kāi)數(shù)據(jù)文件,保存數(shù)據(jù)
? ? ? ? with open("history_data.txt", "a") as file:
? ? ? ? ? ? # 將字典轉(zhuǎn)化為字符串保存
? ? ? ? ? ? file.write(str(info_dict))
? ? ? ? ? ? file.write("\n")

? ? def save_query_results_to_file(self, query_results):
? ? ? ? """將查詢(xún)結(jié)果保存到指定數(shù)據(jù)文件"""
? ? ? ? # 接收輸入文件名
? ? ? ? file_name = input("請(qǐng)輸入要保存數(shù)據(jù)的文件名(格式:xxx.txt ):")
? ? ? ? with open(file_name, "a") as file:
? ? ? ? ? ? # 將數(shù)據(jù)轉(zhuǎn)化為字符串保存
? ? ? ? ? ? file.write(str(query_results))
? ? ? ? ? ? file.write("\n")
? ? ? ? print("查詢(xún)結(jié)果保存成功,文件名為:%s" % file_name)

? ? def print_func(self, info_dict, query_results):
? ? ? ? """格式化打印輸出查詢(xún)結(jié)果"""
? ? ? ? # 需要完整代碼請(qǐng)?jiān)谖恼挛恼碌撞刻砑游⑿牛顿M(fèi)咨詢(xún)
? ? ? ? pass

2.4 車(chē)元素模塊Car.py

# coding = utf-8
# 模塊中的__all__屬性:可以規(guī)定 模塊中 from module_name import * 只能夠?qū)氲囊恍╊?lèi)、變量、函數(shù)名
__all__ = ['Car']
import time
from ParkingManagementSystem import *


class Car(ParkingManagementSystem):
? ? """數(shù)據(jù)元素類(lèi):定義一個(gè)關(guān)于車(chē)的類(lèi)"""

? ? def __init__(self):
? ? ? ? """對(duì)車(chē)的屬性進(jìn)行初始化"""
? ? ? ? # 測(cè)試時(shí)使用
? ? ? ? print("Car 中__init__調(diào)用成功!")
? ? ? ? # 設(shè)定初始出場(chǎng)時(shí)間和消費(fèi)金額為空
? ? ? ? self.exit_time = None
? ? ? ? self.cost = None
? ? ? ? # 初始編號(hào) id 為 1
? ? ? ? self.id = 1
? ? ? ? # 讀取文件中編號(hào)
? ? ? ? try:
? ? ? ? ? ? with open("count_id.txt", "r") as file:
? ? ? ? ? ? ? ? self.id = int(file.read())
? ? ? ? except Exception as result:
? ? ? ? ? ? pass
? ? ? ? # 測(cè)試時(shí)使用
? ? ? ? print(self.id)

? ? def get_parking_info(self):
? ? ? ? """獲取車(chē)輛停車(chē)信息"""
? ? ? ? # 調(diào)用父類(lèi)中的屬性
? ? ? ? ParkingManagementSystem.__init__(self)
? ? ? ? car_type = input("請(qǐng)輸入車(chē)類(lèi)型(car 或 truck):")
? ? ? ? # 判斷車(chē)位是否已滿(mǎn),如已滿(mǎn)則提示客戶(hù)去其他停車(chē)場(chǎng),如未滿(mǎn)則分配一個(gè)車(chē)位給客戶(hù)
? ? ? ? if car_type == "car":
? ? ? ? ? ? # 如車(chē)位已滿(mǎn),提醒客戶(hù)去其他停車(chē)場(chǎng),car類(lèi)型的車(chē)位設(shè)定為100個(gè)
? ? ? ? ? ? if len(self.car_stall) >= 100:
? ? ? ? ? ? ? ? print("小汽車(chē)車(chē)位已滿(mǎn),請(qǐng)去其他停車(chē)場(chǎng)。")
? ? ? ? ? ? ? ? return
? ? ? ? ? ? # 如還有車(chē)位,則分配一個(gè)車(chē)位給客戶(hù)
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? # 不同車(chē)型不同價(jià)位
? ? ? ? ? ? ? ? price = 10
? ? ? ? ? ? ? ? # 車(chē)位編號(hào)為:1-100
? ? ? ? ? ? ? ? for i in range(100):
? ? ? ? ? ? ? ? ? ? # 分配空著的車(chē)位編號(hào)
? ? ? ? ? ? ? ? ? ? if i + 1 not in self.car_stall:
? ? ? ? ? ? ? ? ? ? ? ? p_number = i + 1
? ? ? ? ? ? ? ? ? ? ? ? self.car_stall.append(p_number)
? ? ? ? ? ? ? ? ? ? ? ? print(self.car_stall)
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? elif car_type == "truck":
? ? ? ? ? ? # 如車(chē)位已滿(mǎn),提醒客戶(hù)去其他停車(chē)場(chǎng),truck類(lèi)型的車(chē)位設(shè)定為50個(gè)
? ? ? ? ? ? if len(self.truck_stall) >= 50:
? ? ? ? ? ? ? ? print("貨車(chē)車(chē)位已滿(mǎn),請(qǐng)去其他停車(chē)場(chǎng)。")
? ? ? ? ? ? ? ? return
? ? ? ? ? ? # 如還有車(chē)位,則分配一個(gè)車(chē)位給客戶(hù)
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? # 不同車(chē)型不同價(jià)位
? ? ? ? ? ? ? ? price = 20
? ? ? ? ? ? ? ? # 車(chē)位編號(hào)為:101-150
? ? ? ? ? ? ? ? for i in range(100, 150):
? ? ? ? ? ? ? ? ? ? # 分配空著的車(chē)位編號(hào)
? ? ? ? ? ? ? ? ? ? if i + 1 not in self.truck_stall:
? ? ? ? ? ? ? ? ? ? ? ? p_number = i + 1
? ? ? ? ? ? ? ? ? ? ? ? self.truck_stall.append(p_number)
? ? ? ? ? ? ? ? ? ? ? ? print(self.truck_stall)
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? else:
? ? ? ? ? ? print("本停車(chē)場(chǎng)沒(méi)有適合該車(chē)型的停車(chē)位,請(qǐng)重新輸入!")
? ? ? ? ? ? return
? ? ? ? # 接收車(chē)位編號(hào)
? ? ? ? car_number = input("請(qǐng)輸入車(chē)牌號(hào)(示例:京A88888):")
? ? ? ? # 接收經(jīng)手人姓名
? ? ? ? handler = input("請(qǐng)輸入經(jīng)手人姓名:")
? ? ? ? # 接收入場(chǎng)時(shí)間
? ? ? ? entrance_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
? ? ? ? # 接收使用日期
? ? ? ? date = time.strftime("%Y-%m-%d", time.localtime())
? ? ? ? # 編號(hào) id 自動(dòng)增長(zhǎng)
? ? ? ? self.id += 1
? ? ? ? # 保存該條停車(chē)信息到字典
? ? ? ? parking_info = {
? ? ? ? ? ? "id": self.id,
? ? ? ? ? ? "car_type": car_type,
? ? ? ? ? ? "car_number": car_number,
? ? ? ? ? ? "handler": handler,
? ? ? ? ? ? "p_number": p_number,
? ? ? ? ? ? "date": date,
? ? ? ? ? ? "entrance_time": entrance_time,
? ? ? ? ? ? "exit_time": self.exit_time,
? ? ? ? ? ? "price": price,
? ? ? ? ? ? "cost": self.cost
? ? ? ? }
? ? ? ? print(parking_info)
? ? ? ? # 返回車(chē)輛停車(chē)信息
? ? ? ? return parking_info

? ? def save_id_to_file(self):
? ? ? ? """保存停車(chē)信息的最大編號(hào) id ,作為下次運(yùn)行id增長(zhǎng)的基礎(chǔ)"""
? ? ? ? with open("count_id.txt", "w") as file:
? ? ? ? ? ? file.write(str(self.id))

三、運(yùn)行測(cè)試

3.1 瀏覽所有信息

3.2 查詢(xún)車(chē)輛信息

3.2.1 按車(chē)牌號(hào)查找

3.2.2 按車(chē)類(lèi)型查找

3.2.3 按使用日期查找

3.2.4 按經(jīng)手人查找

3.2.5 查詢(xún)歷史記錄

3.3 入場(chǎng)車(chē)輛錄入

3.4 出場(chǎng)車(chē)輛刪除

3.5 退出管理系統(tǒng)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論