Building a Car Rental Website

Web Application Development: Building a Car Rental Website

Summer 2024

Allocation

This coursework is worth 100% of the marks for module You will also need skills from the following modules:

● ● ● ●

(Python Programming) (Design reporting) (Database design)

(Secure implementation)

Objective:

The objective of this coursework is to design and develop a fully functional car rental website. Students will use HTML, CSS, JavaScript + DOM (or jQuery), Flask, and MySQL to create a responsive and dynamic web application for a single car rental company.

Coursework Description:

Students will create a web application that allows users to rent cars from a single company. The application should include user registration and login, searching for available cars, making reservations, and an admin panel for managing cars and reservations.

The following is the basic functionality to implement for each type of users: Regular Users:

1. User Registration:

o Form for new users to sign up, including username, real name, date ofbirth, adress

and password.

o Form validation and secure password storage (using encryption).

2. User Login:

o Login form for existing users.

o Session management to keep users logged in.

3. View Available Cars:

o Page displaying all available cars.

4. Car Detail View:

o Detailed information about selected car: Make (e.g., BYD, Toyota ...), Model, Year,

Colour.

o Car images and specifications.

5. Make a Reservation:

o Form to book a car with date selection, customer can rent one only car per reservation,

not allowed having multiple reservations at the sametime, information needed are:

Start date/time, End date/time and calculated duration in hours and days. o Validation to prevent booking conflicts.

6. View and Manage Reservations:

o Page for users to see their reservations. o Option to cancel upcoming reservations.

Admin:

1. Admin Login:

o Secure login for admin users.

o Separate from regular userlogin.

2. Manage Cars:

o Admin panel for adding, updating, and deleting car records. o Form validation and confirmation prompts.

3. Manage Reservations:

o Admin view of all reservations.

o Options to edit or cancel reservations.

The marks available for each of these areas of functionality are divided based on the sections of the

coursework, as described below. Simply writing code to meet the specification by any means will not earn full marks.

Restrictions

Your web site must run in a Python virtual environment built by running the following commands from a Command Prompt in a suitable working directory:

pip install virtualenv virtualenv webtest

cd webtest

scripts\activate

pip install flask mysql-connector-python

It is recommended that you also use this virtual environment for development. Regardless, you must test your site within the virtual environment before submitting it. This is the virtual environment in which your code will be tested by the assessor. If it does not work, marks will not be awarded.

In addition to the libraries in the above virtual environment, you may use the jQuery library for JavaScript, but may not use any other frameworks or libraries. This means that you may not use

libraries that are “Flask extensions” if they are not installed with Flask.

(Please do not send e-mails asking if you can use other extension libraries; the answer is no. The

purpose of the coursework is to understand how JavaScript and server interaction work at the lowest level possible, not in terms of abstractions created by higher level code.)

Your website must be built using HTML 5 and ECMAscript 6 on the client, and Flask, MySQL and Python 3 on the server.

Plagiarism

This is individual work. You must not copy or share code with other students. Do not copy code from online sources, answers, tutorials or existing open-source software. Copied code will result in the plagiarism process being invoked and you maybe asked to attend an online meeting to verify that your understanding of your code is consistent with you having written it.

You must be very careful with the use of online tutorials on this module. Your primary learning source should be the module notes and the lecturer and tutorial staff. There are a very large number of

online tutorials on the topic of web development, but many are incorrect, out-of-date, or badly written.

Sites which present code and then explain it are often cheating sites, not tutorials. Retroactively explaining large amounts of code is not an effective learning method, but is often used as a trick to

“justify” presenting code actually intended to be cut and pasted. Often the explanations are extremely poor or even incorrect and will confuse your understanding further.

Submission

Submission is in two stages:

● The website documentation report.

● The actual website.

Due Date: Website documentation report:

Website:

The website documentation report is worth 40% of each component of the marks from the Specification section. The implementation is worth 60%.

Code implemented in the final submission but not reported on in the actual report can still score full marks on the other two components, but you will lose out on potential feedback on your report.

Website Documentation Report

The website documentation report should cover the design and structure of implementation you intend to use to produce the selected functionality. This should include:

• ER diagram for database used in the website.

• Wireframes representing the user interface;

• Description of the tests performed on the website (functions, database ...)

Website

Students are expected to start developing the website from the first week of the semester, the website should be uploaded as a .zip file to the student website by (Date to be announced). To prepare

your .ZIP file, do the following steps:

1. Prepare a fresh virtual environment via the commands described in the “restrictions” section.

2. Copy your website files into the virtual environment, activate it, and ensure that your website works inside it.

3. Use the mysqldump utility to output your database specification into a file in the virtual environment. (The mysqldump.exe file is in the bin directory of the MySQL Server install path.)

4. Delete the directories Include, Lib, Scripts, and tcl. 5. ZIPthevirtualenvironmentdirectory.

The 60% of the section mark for the website is divided as follows:

● The basic functionalities: 30%.

● Quality of user interface design: 10%.

● Quality of back-end architecture: 20%.

Remember to break down processes in detail to allow these to be described. “The user can click to login” is not sufficient detail - the process of logging in is a multi-stage one that will likely involve several communications between the client and server, and use of the database.

It is not necessary to include source code in the report. The report will be your main opportunity to gather feedback before the submission (although you may also ask for help in practical sessions) so make sure to provide detail on any decisions you are not sure about, so that the assessor can provide useful feedback.

The website documentation report should be submitted on the student website by (Date to be announced). You may have already started developing your implementation before this submission.

Overall Mark Scheme Basic functionality

Website Documentation Report 40% General Implementation 30% User Interface 10% Back-End Implementation 20% Component total 100%

Tips

Using the lecture material

The lecture material and practical’s do not directly walk you through the coursework, but it can be completed by applying the skills they teach.

● Session 7 will help you think about designing your database. The specification includes administrators, users... Think about what needs to be stored about each one and how they

relate to each other, and what data needs to be stored about the relationships.

● Think about database transactions - what is the list of actions that the user can take that alter

the database? How can you write each one as a query? Think back to CHC4007 and

consideration of use cases.

● What input does each transaction need, and how can you get that from the user over the web?

● How will you send the input to the server? First, in what form? How can you make it easy for your program to work with but also secure? Again, see sessions 1-4. Second, how will you actually send it over the web? See sessions 5 and 8 for your options.

● Can you now write the Python program for the transaction and assign it to be a Flask route? See sessions 5 and 6 as well as general Python programming from CHC4007.

● How will you return the response to the user? Will you use a web template (session 6) or maybe a JavaScript program that reads from the server using AJAX (session 9)?

● Is the transaction “stateful” - meaning that it changes the treatment of other transactions after it, such as logging in? If so, what do you need to store in the Flask session variable (session 6) to allow this?

Previous Common Errors

Here are some previous mistakes frequently made by students on Web Development coursework. Please be careful not to repeat them!

Website documentation report

Sessions 1-4 will help here.

● Repeating what is stated in the specification as if it was your decision rather than what you have been told to do.

● Describing what is stored on the client or server, but not what functionality they have.

● Writing many-to-one relationships with the foreign key on the wrong side.

● Trying to store foreign keys to two different tables in the same field without distinguishing

them.

● Not showing data table descriptions, only sample data that does not formally indicate

structure.

● Omitting field types from specifications.

● Stating that the “user will be logged in” without indicating what method is used to signal this.

● Large amount of dead space on UI designs.

● Showing UI prototypes instead of wireframes.

● Where search is implemented, not providing a wireframe for the search results page.

Web site

● Using unauthorized libraries such as flask extentions (Flask_login,

Flask_MYSQLAlchemy, ....), blueprint, pymysql.. or JavaScript libraries other than JQuery

(Layui.js, Flatpckr.js ... JavaScript frameworks)

● Failing to implement all basic functionality.

● Functions on the server that require the user to be logged in don’t actually check that the user

is logged in.

● Storing passwords in cleartext in the database.

● Making the database or on-screen fields for a comment text too short for messages to be

entered.

● Duplicated data in the database, violating normal form.

● Missing or redundant foreign keys in tables.

● Search loads entire table and searches it in Python rather than using SQL database search.

● Can only search exact, not partial, matches.

  • 11
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1 目标检测的定义 目标检测(Object Detection)的任务是找出图像中所有感兴趣的目标(物体),确定它们的类别和位置,是计算机视觉领域的核心问题之一。由于各类物体有不同的外观、形状和姿态,加上成像时光照、遮挡等因素的干扰,目标检测一直是计算机视觉领域最具有挑战性的问题。 目标检测任务可分为两个关键的子任务,目标定位和目标分类。首先检测图像中目标的位置(目标定位),然后给出每个目标的具体类别(目标分类)。输出结果是一个边界框(称为Bounding-box,一般形式为(x1,y1,x2,y2),表示框的左上角坐标和右下角坐标),一个置信度分数(Confidence Score),表示边界框中是否包含检测对象的概率和各个类别的概率(首先得到类别概率,经过Softmax可得到类别标签)。 1.1 Two stage方法 目前主流的基于深度学习的目标检测算法主要分为两类:Two stage和One stage。Two stage方法将目标检测过程分为两个阶段。第一个阶段是 Region Proposal 生成阶段,主要用于生成潜在的目标候选框(Bounding-box proposals)。这个阶段通常使用卷积神经网络(CNN)从输入图像中提取特征,然后通过一些技巧(如选择性搜索)来生成候选框。第二个阶段是分类和位置精修阶段,将第一个阶段生成的候选框输入到另一个 CNN 中进行分类,并根据分类结果对候选框的位置进行微调。Two stage 方法的优点是准确度较高,缺点是速度相对较慢。 常见Tow stage目标检测算法有:R-CNN系列、SPPNet等。 1.2 One stage方法 One stage方法直接利用模型提取特征值,并利用这些特征值进行目标的分类和定位,不需要生成Region Proposal。这种方法的优点是速度快,因为省略了Region Proposal生成的过程。One stage方法的缺点是准确度相对较低,因为它没有对潜在的目标进行预先筛选。 常见的One stage目标检测算法有:YOLO系列、SSD系列和RetinaNet等。 2 常见名词解释 2.1 NMS(Non-Maximum Suppression) 目标检测模型一般会给出目标的多个预测边界框,对成百上千的预测边界框都进行调整肯定是不可行的,需要对这些结果先进行一个大体的挑选。NMS称为非极大值抑制,作用是从众多预测边界框中挑选出最具代表性的结果,这样可以加快算法效率,其主要流程如下: 设定一个置信度分数阈值,将置信度分数小于阈值的直接过滤掉 将剩下框的置信度分数从大到小排序,选中值最大的框 遍历其余的框,如果和当前框的重叠面积(IOU)大于设定的阈值(一般为0.7),就将框删除(超过设定阈值,认为两个框的里面的物体属于同一个类别) 从未处理的框中继续选一个置信度分数最大的,重复上述过程,直至所有框处理完毕 2.2 IoU(Intersection over Union) 定义了两个边界框的重叠度,当预测边界框和真实边界框差异很小时,或重叠度很大时,表示模型产生的预测边界框很准确。边界框A、B的IOU计算公式为: 2.3 mAP(mean Average Precision) mAP即均值平均精度,是评估目标检测模型效果的最重要指标,这个值介于0到1之间,且越大越好。mAP是AP(Average Precision)的平均值,那么首先需要了解AP的概念。想要了解AP的概念,还要首先了解目标检测中Precision和Recall的概念。 首先我们设置置信度阈值(Confidence Threshold)和IoU阈值(一般设置为0.5,也会衡量0.75以及0.9的mAP值): 当一个预测边界框被认为是True Positive(TP)时,需要同时满足下面三个条件: Confidence Score > Confidence Threshold 预测类别匹配真实值(Ground truth)的类别 预测边界框的IoU大于设定的IoU阈值 不满足条件2或条件3,则认为是False Positive(FP)。当对应同一个真值有多个预测结果时,只有最高置信度分数的预测结果被认为是True Positive,其余被认为是False Positive。 Precision和Recall的概念如下图所示: Precision表示TP与预测边界框数量的比值 Recall表示TP与真实边界框数量的比值 改变不同的置信度阈值,可以获得多组Precision和Recall,Recall放X轴,Precision放Y轴,可以画出一个Precision-Recall曲线,简称P-R
I'm sorry, but as an AI language model, I am not able to submit program code or screenshots of program output. However, I can provide you with guidance on how to approach this problem. To develop a vehicle rental system, you can use a programming language like Python and create a console-based interface using the built-in input and print functions. Here is a general outline of how you can implement the system: 1. Create a list of vehicle models with their specific information (e.g., brand, model, seating capacity, fuel type, etc.), daily rent, and discount information (e.g., 10% off for renting more than 7 days). 2. Display the list of vehicle models and their information to the user using the print function. 3. Prompt the user to input the model of the vehicle they want to rent, as well as the number of days they want to rent it for, using the input function. 4. Validate the input to ensure that the user has entered a valid model and a positive number of days. If the input is invalid, display an error message and prompt the user to input again. 5. Calculate the rent based on the daily rent and any applicable discounts, and display the total rent to the user using the print function. 6. End the program. Here is some example code to get you started: ``` # Define the list of vehicle models and their information vehicles = [ { 'model': 'Sedan', 'info': 'Brand: Honda | Model: Civic | Seating Capacity: 5 | Fuel Type: Gasoline', 'daily_rent': 50, 'discount': 0.1 }, { 'model': 'SUV', 'info': 'Brand: Toyota | Model: RAV4 | Seating Capacity: 7 | Fuel Type: Gasoline', 'daily_rent': 70, 'discount': 0.15 }, { 'model': 'Coach', 'info': 'Brand: Mercedes | Model: Tourismo | Seating Capacity: 50 | Fuel Type: Diesel', 'daily_rent': 300, 'discount': 0.2 } ] # Display the list of vehicle models and their information print('Available Vehicles:') for vehicle in vehicles: print(vehicle['model']) print(vehicle['info']) print('Daily Rent:', vehicle['daily_rent']) print('Discount:', vehicle['discount']) print() # Prompt the user to input the model and number of days model = input('Enter the model of the vehicle you want to rent: ') days = input('Enter the number of days you want to rent it for: ') # Validate the input valid_input = False while not valid_input: try: days = int(days) if days <= 0: print('Error: Number of days must be positive') else: for vehicle in vehicles: if vehicle['model'] == model: rent = vehicle['daily_rent'] * days * (1 - vehicle['discount']) print('Total Rent:', rent) valid_input = True break else: print('Error: Invalid vehicle model') break except ValueError: print('Error: Number of days must be an integer') break ``` This is just a basic example, and you may need to customize it further to meet your specific requirements and handle more edge cases.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值