icon picker
hotel

based on SQA exam paper 2019 q14

basic scenario

A travel company performs a search on a particular location and exports the following data about hotels to a text file.
Hotel name
Star rating from 1 to 5
The price per night for a room
Review score from previous guests from 0 to 10

A sample of the data in the text file is shown below.
Club Praia de Oure,4,47.00,7.0
Adriano Beach Club,4,121.25,8.3
The developer should use an array of records to store the data.

tasks

below are some development tasks based on the scenario

hotel 1 (read, display)

task assumes
ability to read a csv file and store into an array of records using a class
ability to display all array elements
ability to insert a conditional to display only required elements

1. Import hotel data
2. Display all five star hotel
Step 2 can be developed by first of all displaying all the hotels and then add code to display only the 5 star hotels

project

Loading…

hotel 2 (count)

additional feature
display and count all the excellent hotels (a rating above 8.0)
imitate the sample solution to display and count the 5* hotels
use a function to count the occurrences and return the result

project

Loading…

hotel 3 (count, user input)

added feature: enable user to enter star level to count

project

Loading…

hotel 4 (max and min)

use find max and min to calculate and display the hotels with highest price and hotel with lowest rating.

project

Loading…

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.