首页 > > 详细

解析R语言 assignment 、R assignment编程辅导、辅导 R assignment 、R编程解析

VG101 — Introduction to
Computer and Programming
Project 2
Manuel — UM-JI (Summer 2018)
• Include simple comments in the code
• If applicable, split the code over several functions
• Extensively test your code and impove it
• Write a single README file per assignment
• Zip all the files and upload the archive on Canvas
1 Project setup
The goal of this project is the design of a program to manage a hotel. The program should be written
in C with a special emphasis on structures and pointers.
Note that many questions are left to the appreciation of the programmers, who in turn should argue
on their choices based on their knowledge, research and understanding of hotel management. All the
decisions should be discussed in the README file.
The minimum set of parameters to define and use is as follows.
• Hotel: more than one floor, each being of different sizes, with flexible bedrooms sizes.
• Visitors: single, couple, family. Visitors can decide to sleep in a dorm, that is sharing their room
with others at a cheaper cost.
• Price: depends on the type of room, if breakfast is provided, etc…
• When checking-in a customer receives a card showing
– The date of arrival
– The room number
– The number of keys provided
– The number of visitors
– The name of each visitor
– The ID number of each visitor
• When a customer checks-out he receives a receipt showing
– The number of nights spent in the hotel
– The room number
– The number of breakfasts served
– The total price
2 Project tasks
Ex. 1 — Hotel utils
Using a link list data structure program several functions allowing to read and write information from a
text file in the format described in box 1.
When parsing the file, anything following the character “#” should be considered a comment and be
ignored. A section represents all the details of a room; each line is composed of a field, some optional
spaces, and a value.
Various fields such as the price and number of nights can be updated in the database file; write the
corresponding functions.
The functions related to the implementation of the linked list should be written in a file calledhotel-ll.c.
The functions specific to the hotel database format should be written in a file calledhotel-db.c. This
file should also include functions that can alter the database, e.g. add/remove breakfasts, increase the
number of nights, adjust the price, or set the current date.
hotel.db – truncated hotel database file
#
#hotelmanagementdatabasefile
#
[room101]
type=dorm#roomtype(dorm,family,double,single)
vacant=3#availablebeds(0/1->occupied/vacantforotherroomtypes)
arrival=11/06/2018#arrivaldate
visitors=3#3visitors
name1=JohnLovis#nameofvisitor1
id1=123456AF#IDnumberofvisitor1
name2=MariaSuza
id2=TV98733K
name3=EvaTuri
id3=00000A
keys=2#2keysgiven
breakfast=0#0breakfastordered,canbeincreasedlateron
nights=1#numberofnightsbooked,canbeincreasedlateron
price=400#totalprice,canbeadjustedwithrespecttobreakfastandnights
[room514]
type=family
vacant=1
[room102]
type=double
vacant=0
arrival=15/05/2018#filetruncatedhere
Box 1: Sample file format
Ex. 2 — Hotel management
1. Write a function which initialises a hotel and its corresponding database file.
2. Write a function taking care of customers checking-in. It should at least update the hotel database
file, and return a card. The card should be generated in a different function.
3. Write a function taking care of customers checking-out. It should at least update the hotel
database file and return a receipt. The receipt should be generated in a different function.
4. Write some functions that allow the number of nights to be increased and the number of breakfast
to be increased or decreased.
5. Write a function which given a type of room returns the list of available rooms and their number.
6. Write a function which returns the list of all the guests, sorted in alphabetical order, their ID, and
how many they are in the hotel.
7. Write a function which returns how much money has been received at the end of a day. Assume
customers pay on a daily basis.
Write all the previous functions in a file calledhotel-mt.c.
Ex. 3 — Demonstration
In the previous two exercises all the functions assuring the good management of a hotel were defined.
Now write a set of functions to simulate a hotel, i.e. generate a random hotel with random visitors that
check-in and out over time, etc.. Demonstrate the well functioning of the setup program,
Allow the user to select (i) the current date, (ii) the time span of the demonstration (in days), (iii) the
number of rooms per floor. Create a directory calledreceiptsand dump all the receipts in it. If the
room is not a dorm them each receipt should be named after theid1field. Otherwise a receipt should
be issues for each visitor.
All those functions should composed a file calledhotel-main.c.
Ex. 4 — Optional tasks
1. Compile exercises 1 and 2 into a library.
2. Write a Command Line Interface (CLI) to manage a hotel.
3. Write a Graphical User Interface (GUI) to manage a hotel. Use a cross-platform. toolkit such as
GTK+, or QT. Using a toolkit that is incompatible with other platforms will not bring any bonus.
Note: feel free to discuss any other idea for a bonus with the teaching team.
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!