Submission Instructions:
Your project must be submitted as a Visual Studio project, including all header and code files, and any
appropriate text files to ensure the program compiles and runs.
You may complete the tasks in your preferred IDE, however you MUST create a Visual Studio project in order to submit. Your project folder must be identified by using your name and assignment number, such as YourFirstNameLastNameID.
The entire project folder must then be zipped up into one zip file for submission. The zip file MUST be named “YourFirstNameLastNameID.zip”. This zip file must be submitted via the Moodle assignment submission page.
Explicit assessment criteria are provided, however please note you will also be assessed on the following broad criteria:
● Meeting functional requirements as described in the exercise description.
● Demonstrating a solid understanding of object-oriented design and C++ coding, including good
practice.
● Following the unit Programming Style Guide.
● Creating solutions that are as efficient and extensible as possible.
NOTE! Your submitted program MUST compile and run. Any submission that does not compile will automatically awarded a 50 marks penalty. This means it is your responsibility to continually compile and test your code as you build it.
Scenario:
You have just joined a new multimedia company called CyberRoo. As a new employee, you have been tasked with creating a text-based prototype for a new writing tool the company has been asked to create by a major client called “The Amazing Story Generator”.
Your job is to demonstrate some of the basic functionality of the program, which will be further developed by the team of programmers after your finish the prototype. To do this you will complete a series of tasks, each building upon the previous task.
Task List:
■ Your project must include an application file (with the main() function) and an associated header file .
■ Create and display a menu that accesses each of the following functions of the program.
■ Read data from a file and display it as an information screen about the application.
■ Read some sample data from a file and store it appropriately.
■ Generate a random story line and display the result using the stored data.
■ Save a story line to file, appending each new storyline saved, at the user’s request.
■ Load all saved story lines from the saved file and display the contents.
NOTE! Your submitted files must be correctly identified and submitted (as described above). Any
submission that does not comply will receive and automatic 20 marks penalty (applied after
marking). Your Visual Studio project should include all .cpp, .h files and StoryAbout.txt file.
2
Task 1: Create and Display a Menu
Your first task is to create and display a menu, just like the one shown here. In the example, option [0]
has been selected, terminating the program.
Create a function called runMenu() and call it from the main() function. From this function, the user must be able to select any of the displayed options as often as they want before ending the program.
Ensure that you validate the user’s input so that only the options displayed can be chosen.
You may process the options as either numeric or single character input, such as [0] or [E] for ending
the program, [1] or [I] for displaying the information, etc.
Task 2: Display an Information Screen
Your next task is to display some information about the application, just like the one shown here.
Create a function called displayInfo() and call it from the runMenu() function, when the [1]
Display “About” Information is selected.
This function must accept a filename as a parameter (“StoryAbout.txt”) and successfully read and display the data. You must also allow the user some time to read the displayed information before returning them to the menu.
You can create this file based on the display below; however it must contain your full name, your student ID, your lab number, lab time, and your tutor’s name. This file must be created and named StoryAbout.txt and must be submitted with your assignment.
3
Task 3: Read and Store Data from Files
Your next task is to read and store the story elements, from text files, and store this data in appropriate variables. This data will be used to generate the randomised story lines in the next task.
Create a function called createLists() and call it from the runMenu() function, when the [2] Read and Store Data from Files is selected.
This function must accept a filename as a parameter and successfully read and store the data. The data is to be stored in 3 collection variables named settings, characters and situations.
You must use the provided 3 files for this section namely settings.txt, characters.txt, and situations.txt. You are not allowed to change the formatting. You may also be required to manipulate the string data, using appropriate string methods.
The menu must automatically call createLists() three times independently for each file to create all 3 collections.
Users should be given correct prompts and feedback to indicate appropriate progress.
4
Task 4: Generate and Display a Random Storyline
Your next task is generate a random story line, using one element from each of the story data collections, and display the result as a concatenated or formatted string.
Create a function called generateStoryLine() and call it from the runMenu() function, when the [3] Generate a Random Story Line is selected.
This function must return a concatenated or formatted string using a randomly selected element from each of the 3 collection variables, created in task 3, in this order:
● one element from settings
● one element from characters
● one element from situations
Ensure that the collection variables have content before trying to select each element, to stop the program from crashing.
See screenshot for an example of the required output.
5
Task 5: Save a Storyline to a File
Your next task is save a story line to a file, called “savedStories.txt”. In this task you must:
● display the last generated story line
● ask the user if they want to save it
○ if so, add it to any existing data in the file. You must not overwrite the existing content.
○ if not, do nothing
● return to the menu when the task is complete
You should display the previously generated storyline and then ask the user to confirm prior to saving it to savedStories.txt. To achieve this you need to create a function called saveStoryData() and call it from the runMenu() function.
If there are no storylines generated already, you must prompt the user to to generate a random storyline first, by using the menu option for generating random storylines (see task 4).
Use the screenshot as a guide for your display and input request. You should also inform the user when the data is saved, before returning to the menu.
6
Task 6: Load Saved Storylines from a File
Your final task is loading the saved story lines from the “savedStories.txt” and displaying them
appropriately.
How you achieve this is dependent upon how you saved the data. The display should be the same as the way you displayed the story line when you generated it.
Use the screenshot as a guide for your display – these two storylines are being displayed in the same way as they were originally generated.
Things you may need to consider:
● How have you saved the data?
○ Did you save the completed strings?
○ Did you use another function?
● How will you display the data after it is read from the saved data file?
You should create a function called loadStoryData() and call it from the runMenu() function, to display the whole stories.
7
Assignment Notes:
It is your responsibility to know what is expected of you. If you are unsure about anything, ask your tutor sooner rather than later. Write any questions and/or notes here to help you clarify what you have to do.
8
Assignment 1: Marking Criteria [100 marks in total]
NOTE: Your submitted project must be correctly identified and submitted, otherwise it will receive an automatic 20 marks penalty (applied after marking).
Does the program compile and run? Yes or No
NOTE! Your submitted program MUST compile and run. Any submission that does not compile will receive an automatic 50 marks penalty (applied after marking).
1.
Application Design [20] 1.1. Header File [10]
1.1.1. Has included appropriate inclusion guards [4]
1.1.2. Has all the correct #include statements [4]
1.1.3. Has the required data members and member functions using meaningful names [2]
1.2. Application File [10]
1.2.1. The main() function has appropriate function calls to keep it uncluttered [2]
1.2.2. Has created all the specified functions and called them appropriately [4]
1.2.3. Has created any additional functions to streamline their code [4]
Functionality [60] 2.1. Task 1: Menu [12]
2.1.1. The runMenu() function correctly initialises any required variables [2]
2.1.2. The menu options are clearly displayed [2]
2.1.3. Appropriate use of loop and decision structures to process user input [4]
2.1.4. Correct use of function calls when responding to user input [2]
2.1.5. The user controls when to return to the menu [2]
2.2. Task 2: About Information [8]
2.2.1. The displayInfo() function uses the correct argument [2]
2.2.2. Appropriate validation checks have been made [2]
2.2.3. Appropriate use of loop and decision structures to read and display data [4]
2.3. Task 3: Reading and Storing Data [10]
2.3.1. The createLists() function uses the correct argument [2]
2.3.2. The collection variables (arrays or vectors) are correctly initialised [2]
2.3.3. Appropriate method(s) used to read the data from the file [2]
2.3.4. Appropriate use of loop and decision structures to read and store data [4]
2.4. Task 4: Generate and Display a Storyline [8]
2.4.1. The generateStoryLine() function returns a string [2]
2.4.2. Validation checks that collection lists have been created [2]
2.4.3. One random data element is selected from each collection [2]
2.4.4. The returned string is correctly concatenated and/or formatted [2]
2.5. Task 5: Save Data to a File [12]
2.
9
2.5.1. The saveStoryData() function uses the correct arguments [4]
2.5.2. The current story line is displayed appropriately [2]
2.5.3. The user is asked whether to save or not with an appropriate process of user input [2]
2.5.4. Appropriate validation for writing the file is in place [2]
2.5.5. The data is correctly written to the specified file [2]
2.6. Task 6: Load Data from a File [10]
2.6.1. 2.6.2. 2.6.3.
The loadStoryData() function uses the correct argument(s) [2] Appropriate validation checks have been made [4]
Appropriate use of loop and decision structures to read and display data [4]
3. Quality of Solution and Code [20]
3.1. 3.2. 3.3. 3.4. 3.5.
3.5.1. 3.5.2.
Does the program perform the functionality in an efficient and extensible manner? [4] Has a well-designed program been implemented? [8]
Appropriate additional functions created to streamline code [4]
Demonstrates the use of logical procedures [4]
Has the Programming Style Guide been followed appropriately? [8]
All functions and variables have meaningful names and use correct camel notation [4] Appropriate use of comments throughout the code [4]
Note: Your tutor may ask you to program part of your assignment in class to
determine that you have completed the work yourself. Failure to do this to an
acceptable level will result in you being referred to the Subject Leader for
plagiarism.
Note: Submitting only .sln file, a zero mark will be granted.
10