Foundations of C++ Assignment 1 – Task-Oriented Project
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Foundations of C++
Assignment 1 – Task-Oriented Project
Submission Instructions:
Your project must be submitted as a Visual Studio project OR Visual Studio Code, including your project 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 OR Visual Studio Code project in order to submit. Your project folder must be identified by using your name and assignment number, such as YourNameA1.
The entire project folder must then be zipped up into one zip file for submission. The zipped file MUST be named “A1-YourFirstNameLastName.zip” – do not include anything else! 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 assignment 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 be awarded a ZERO. This means it is your responsibility to continually compile and test your code as you build it. |
NOTE! Your submitted files must be correctly identified and submitted (as described above). Any submission that does not comply will receive and automatic 10% penalty (applied after marking). |
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 creative writing tool the company has been asked to create by a major client called “The Amazing Mad Lib Story Generator”.
“Mad Libs is a phrasal template word game where one player prompts others for a list of words to substitute for blanks in a story, before reading the – often comical or nonsensical – story aloud. The game is frequently played as a party game or as a pastime.”Wikipedia
Your job is to demonstrate the basic functionality of the program, to be further developed by the team of programmers after your finish the prototype. To do this you must complete a series of tasks, each building upon the previous task.
Task List:
Your project must include a header and an application file – each correctly formatted.
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 Mad Lib story and display the result using the stored data.
Save a Mad Lib story to file, appending each new character saved, at the user’s request.
Load all saved Mad Lib stories from the saved file and display the contents.
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.
The options should be displayed using its own function.
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 displayTextData() and call it
from the runMenu() function when option [1] Display
“About” Information is selected.
This function must accept a filename as a parameter
(MadAbout.txt) then read and display the data.
You must allow the user some time to read the displayed
information before returning them to the menu.
You can copy MadAbout.txt into the appropriate folder to
read and display, instead of creating your own. However,
you may need to modify the format of the data, depending
on how you intend to import it into your program.
You may create your own information if you wish. If you do, keep it short!
Task 3: Read and Store Data from a File
Your next task is to read and store the Mad Lib data, from
one (or more) text files, and store this data in appropriate
variables. This data will be used to generate the
randomised Mad Libs in the next task.
Create a function called createLists () and call it from
the runMenu() function when option [2] Read and Store
Data from File is selected.
This function must accept a filename as a parameter (“*.txt”)
and successfully read and store the data. The data is to be
stored in two collection variables named madLibs, and
madBits.
You can choose to read the data from a single file, storing
each data set in the different variables, OR read and store
each data set with two separate calls to the same function
with different arguments OR use another suitable method
of your own devising.
You may also be required to manipulate the string data, using appropriate string methods.
The data for the two individual collections can be found in MadLibData.txt, which you can modify or change to suit your method of reading and storing the data, instead of writing your own. You are free to write your own data, if you wish. Remember to name and store your text files as required by the brief.
The data for the mad bits is currently written so that it identifies the types of words the user must input for its matching Mad Lib. The Mad Libs themselves have place holders for each word, which will be replaced by the user’s input.
令 a NAME, a VERB ending in ING, a plural NOUN, a NOUN
令 WORD was WORD the WORD for their latest WORD.
Task 4: Generate and Display a Random Mad Lib
Your next task is generate a random Mad Lib, using 3 different elements from the mad libs collection, and ask the user to input appropriate words, using the associated mad bits and display the result as a concatenated or formatted
string.
Add a function generateMadLib() and call
it from runMenu() function when option [3]
Generate a Random Mad Lib is selected.
This function must return a formatted or
concatenated string using three randomly
selected Mad Libs. The user is asked to type
in words of the specific type, using the
matching mad bits data for each selected Mad
Lib. Each Mad Lib use have at least four (4)
inputs.
You will need to use a number of string
manipulation techniques to achieve the
desired result. Think through the process
carefully before you start to write your code.
Hint: work it out using pen and paper first
using one Mad Lib.
You must ensure that both the collection
variables have content in them before trying to
select an element, to stop the program from
crashing.
See screen shot for an example of the
required input and output.
Task 5: Save a Mad Lib to a File
Your next task is to save a Mad Lib to a file, called
“savedMadLibs.txt” .
In this task you must:
令 display the last generated Mad Lib
令 ask the user if they want to save it
if so, add it to any existing data in the file
if not, do nothing
令 return to the menu when the task is complete
You should also inform the user when the data is
saved, before returning to the menu.
Use the screen shot as a guide for your display and
input request.
Task 6: Load Saved Mad Libs from a File
Your final task is loading the saved Mad Libs from the “savedMadLibs.txt” and displaying them appropriately . How you achieve this is dependent upon how you saved the data. Ideally, the display should be the same as the way you displayed the Mad Lib when you generated it.
Use the screen shot as a guide for your display – these Mad Libs are being displayed in the same way as they were
originally generated .
Things you may need to consider:
令 Do the collection lists need to be initialised
before you display the saved data?
令 How have you saved the data?
Did you save the random numbers for
each element type?
Did you save the completed strings?
Did you use another method?
令 How will you display the data after it is read
from the saved data file?
Which method is the most efficient way to
display it?
令 How will you ensure that the user has time to read the output before returning to the menu?
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.
Assignment 1: Marking Criteria [100 marks in total]
NOTE: Your submitted project must be correctly identified and submitted, otherwise it will receive an automatic 10% penalty (applied after marking).
Does the program compile and run? Yes or No
NOTE! Your submitted program MUST compile and run. Submissions that do not compile will receive ZERO. Testing User Functionality [30]
Your program will be run to test all the following functionality. If the functions work as required by the brief, you will earn the associated marks for each “check” on this list. If the function does not work correctly, no marks will be given.
令 Task 1: runMenu() function [8]
The screen is cleared before displaying the menu options [1]
An appropriate prompt message is display for user selection [1]
Each individual user selection calls the correct function [ 1]
Within selected function appropriate feedback (prompts) given to user [1]
Appropriate feedback is given when user makes a mistake [1]
The programme does not crash if the user makes a mistake [ 1]
The user controls when to return to the menu from all options [ 1]
Program exits correctly with appropriate message displayed [1]
令 Task 2: displayTextData() function [4]
The screen is cleared before displaying the data [1]
The function reads the correct file [1]
The data is displayed in an appropriately formatted manner [1]
User is given time to read the screen [1]
令 Task 3: createLists() function [4]
Functions that require the use of a list work correctly [1]
Appropriate validation checks have been made if file does not exist [1]
The correct file names are used to read the data from the file [1]
Appropriate feedback is given as the data is being loaded (read) from the file [1]
令 Task 4: generateMadLib() function [6]
Validation checks that collection lists have been created first [1]
Three random Mad Libs are selected from the madLibs list [1]
The user is asked for 4 specific inputs using appropriate prompts for each Mad Lib [1]
Validation check to see that user cannot input empty strings [1]
The input data is correctly integrated into each of the Mad Libs [1]
The completed Mad Libs are correctly concatenated and/or formatted [1]
令 Task 5: saveData() function [5]
The current Mad Lib is displayed appropriately [1]
The user is asked whether to save this Mad Lib or not [1]
Appropriate feedback is given when the data is written to file [1]
Appropriate validation checks have been made if file does not exist [1]
The data is correctly written to the specified file [1]
令 Task 6: loadData() function [3]
The saved data is loaded and displayed from the correct file [1]
Appropriate validation checks have been made if file does not exist [1]
Avoids writing redundant code [1]
Application Design [20]
令 Header File [5]
Correct inclusion guards in place (#ifndef…#endif NOT #pragma once) [ 1]
All required #include files added [ 1]
Has declared and typed appropriate variables or constants used in the application [1]
Has correctly formatted all function prototypes as required by the brief [1]
Includes the associated header file with an appropriate file name (NOT header.h) [1]
令 Application File [15]
Has given the application file an appropriate file name (NOT source.cpp) [ 1]
Includes the appropriate header file [1]
The main() function has appropriate function calls to keep it uncluttered [ 1]
Has the required data members and member functions using specified names [ 1]
The structure of each function is correct as required by the brief [1]
All functions requiring an argument have the correct argument sent [1]
All functions requiring returned data have the correct return data type [1]
Has used other functions to streamline their code [ 1]
Has applied appropriate data types and initialised local variables used within a function [1]
Uses an appropriate loop structure for processing user input [1]
Processes and validates user input using appropriate functions [1]
Processes and validates reading and writing files [1]
Processes and validates data loaded from file into appropriate collection variables [1]
User interface maintains readability when executing requested functions [1]
Appropriate use of white space is applied to make reading the screen easier [1]
Evidence of Appropriate Testing and Validation [20]
令 Is there appropriate evidence of usability testing? [20] When entering a number, is the correct range given? [1]
Is the number input a valid number within the required range? [1]
When entering a string or character, does it verify the string/character in not empty? [1]
Is the user asked to repeat an input if the input is deemed invalid? [1]
Are files checked to be open before reading or writing data? [1]
Data written to files is appended to existing data not overwritten [1]
Are all open files are closed correctly? [1]
Are collection variables cleared before using them? [1]
Are collection variables checked to see if they are empty before using them? [1]
Are all loops correctly constructed to suit the required purpose? [1]
For loops are not terminated using a break statement [1]
While loops do not use while(true) [1]
While loops are terminated by changing an appropriate expression or value [1]
If structures use appropriate expressions to evaluate the required condition [1]
Demonstrates the use of a Switch structure [1]
srand() is used to seed random numbers only once [1]
All functions required returned data use a return statement [1]
Demonstrates the use of appropriate String class methods [1]
Are appropriate prompt messages use to give direction to the user? [1]
Is appropriate feedback given to the user when a validation check fails? [1]
令 Do all of the above tests ensure the programme does not crash? [10] Deduct 0.5 of a mark for each failed test above.
Quality of Solution and Code [20]
令 Present
2022-08-27