I am doing a GCSE NEA project for practice.
Customer Loyalty Scheme
The managers of Crawdale Hotel Group have decided to update their customer loyalty scheme. Customers joining the scheme become silver members. Customers are upgraded to gold members when they have booked 30 nights’ accommodation and to platinum once they reach 100 nights.
Silver members receive 2500 loyalty points per night booked, gold members receive 3000 points and platinum members 4000 points. The data is stored as a text file.
The data in this table is provided in the SampleData2017.txt file.
+----------+-----------+------------+------------------+--------------+---------------+ | MemberID | Surname | YearJoined | MembershipStatus | NightsBooked | PointsBalance | +----------+-----------+------------+------------------+--------------+---------------+ | Gri33415 | Griffiths | 2015 | Gold | 35 | 40000 | +----------+-----------+------------+------------------+--------------+---------------+ | Smi22316 | Smith | 2016 | Silver | 3 | 7500 | +----------+-----------+------------+------------------+--------------+---------------+ | Mia56213 | Miah | 2013 | Platinum | 140 | 165000 | +----------+-----------+------------+------------------+--------------+---------------+ | All78915 | Allen | 2015 | Platinum | 120 | 145000 | +----------+-----------+------------+------------------+--------------+---------------+ | Hug91714 | Huggett | 2014 | Platinum | 150 | 50000 | +----------+-----------+------------+------------------+--------------+---------------+ | Sel77617 | Selby | 2017 | Gold | 40 | 45000 | +----------+-----------+------------+------------------+--------------+---------------+ | San55614 | Santus | 2014 | Silver | 12 | 30000 | +----------+-----------+------------+------------------+--------------+---------------+ | Lee44213 | Leewah | 2013 | Silver | 15 | 37500 | +----------+-----------+------------+------------------+--------------+---------------+
The loyalty points can be redeemed for nights at the hotels. A night costs 25000 points.
Requirements
The managers want a computer program to help them operate the scheme efficiently. The program must allow hotel staff to add new members to the scheme, record nights booked and points redeemed. It must also update a member’s points balance each time they book nights or redeem points, upgrade their membership status when appropriate and allow the number and status of the members to be monitored.
The number of nights in a single booking must be limited to a maximum of 14.
The program must allocate a unique ID to each new member consisting of the first three letters of their surname, plus a three-digit number, followed by the last two digits of the current year.
Your task is to analyse these requirements and to design, implement, test and evaluate a solution. You will need to make some assumptions and decisions of your own.
Below is my code. Can you please tell me if I need any improvements or anything?
while True:
import random
import time
select = input("=============================\n\nA - Add new user \nB - Book a night \nC - Check everyones account information \nR - Redeem a night \nQ - Quit System \nChoose an option: ")
if select == 'A':
hotelfile = open("SampleData2017.txt", "a+")
membersname = input("What is your surname? ")
eighteen = ("18")
username = membersname[0:3] + str(random.randint(100, 999)) + eighteen
print("Your username is ", username)
comma = (",")
hotelfile.write (username)
hotelfile.write (comma)
hotelfile.write (membersname)
hotelfile.write (comma)
hotelfile.write ("2018")
hotelfile.write (comma)
hotelfile.write ("Silver")
hotelfile.write (comma)
hotelfile.write ("0")
hotelfile.write (comma)
hotelfile.write ("0")
hotelfile.write ("\n")
hotelfile.close()
elif select == 'B':
print("test")
elif select == 'C':
hotelfile = open("SampleData2017.txt", "r+")
for line in hotelfile:
print (line)
hotelfile.close()
elif select == 'Q':
break
else:
break
SampleData2017.txt
Gri33415,Griffiths,2015,Gold,35,40000
Smi22316,Smith,2016,Silver,3,7500
Mia56213,Miah,2013,Platinum,120,145000
Hug91714,Hugget,2014,Platinum,150,50000
Sel77617,Selby,2017,Gold,40,45000
San55614,Santus,2014,Silver,12,30000
Lee44213,Leeway,2013,Silver,150,37500
import csv
? This would make the exercise very easy (avoids the necessity of you writing the file input/output handling). \$\endgroup\$