This assignment is due by Thursday, June 6, 2019, 11:59 PM.
As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must be provided in accordance with the course collaboration policy.
Do not forget to complete the following labs with this set: L6A,
L6B,
L6C,
L6D,
L6E,
L6F
.
· Instructions · Rubric · Submission ·
Overview
Program from what YOU KNOW
ABCUF
main
doesn't do much "low level stuff" but rather leverages functions in
order to do what your program needs to do.
main
. Use functions:
CreateShoppingList();
BuyIngredients();
GatherIngredientsInKitchen();
PourYourselfGlassOfFineChianti();
MakeDough();
MakaSauce();
//...
CookPizza();
return 0;
}
The Specifics Part I: User Input
I'm done!
" to signify they have finished entering sentences. What should we do with
each sentence the user enters? Read on.The Specifics Part II: Counting
THE
, ThE
, the
, and tHE
all are the same
word.struct
named WordCount
to represent a word and the number of occurrences. It must have two
members, a count
stored as an int
and a word
stored as a string
. Since this struct definition will be used in
multiple files, you will need to create this in its own header file and
then include this header in any other file that requires the use of the WordCount struct.The Specifics Part III: Statistics
# 2 WORDS2 : 14
...
#21 WORDS21 : 1
Least Frequent: WORDS21 ( 1)
A: 30.123% B: 0.532% C: 10.001% ... Z: 5.330% Most Frequent: Q (1000) Least Frequent: E (0)
Example Run
Enter as many sentences as you like and enter "I'm done!" when completed: The quick brown fox jumps over the lazy dog. A man, a plan, a canal, Panama. The quick brown fox jumps over the lazy dog. This is quite fun. THE THe ThE The tHE tHe thE the I'm done! Word Counts ----------- # 1 A 3 # 2 BROWN 2 # 3 CANAL 1 # 4 DOG 2 # 5 FOX 2 # 6 FUN 1 # 7 IS 1 # 8 JUMPS 2 # 9 LAZY 2 #10 MAN 1 #11 OVER 2 #12 PANAMA 1 #13 PLAN 1 #14 QUICK 2 #15 QUITE 1 #16 THE 12 #17 THIS 1 Most Frequent: THE (12) Least Frequent: CANAL (1) Letter Counts ------------- A: 9.302% B: 1.550% C: 2.326% D: 1.550% E: 11.628% F: 2.326% G: 1.550% H: 10.078% I: 3.876% J: 1.550% K: 1.550% L: 3.101% M: 3.101% N: 5.426% O: 6.202% P: 3.101% Q: 2.326% R: 3.101% S: 3.101% T: 10.853% U: 4.651% V: 1.550% W: 1.550% X: 1.550% Y: 1.550% Z: 1.550% Most Frequent: E (15) Least Frequent: B (2)
Functional Requirements
- You may not make use of the standard library functions sort(), find(), any_of() or anything else from #include <algorithm>. You must implement your own sorting and searching functions.
- Use functions. The function prototypes must be written in a separate header file. The function definitions must be defined in a separate implementation file. DO NOT use global variables. You must use parameters properly, either pass-by-value or pass-by-reference.
- The WordCount struct must be declared in its own header file.
- Output must match the formatting in the example.
Hints
- Do not wait until the day before this is due to begin.
- As discussed above, we encourage you to Always Be Using Functions. However, there is nothing wrong with doing all of your steps inside main at first and then refactoring your work into functions later, once your program is working. By the end, you should have your functions in a separate file as we've previously done.
- Do not just dive into the assignment. Create a mental plan of what tasks your program needs to accomplish. Convert this to pseudocode. Tackle the first task and conduct a sanity check. Then tackle the next task (eg, "can I read all the words in the sentence, and store the frequencies of each word?") and conduct another sanity check. We strongly suggest writing your program (one step at a time!)
Grading Rubric
Your submission will be graded according to the following rubric.
Points | Requirement Description |
2 | All code submitted properly. |
12 | All labs completed and submitted L6A, L6B, L6C, L6D, L6E, L6F |
4 | Output format matches specifications from example. |
1 | Output matches example test case. |
2 | Output matches private test cases. |
5 | Words and letters are properly sorted ignoring case. |
5 | Arrays, vectors, string, structs used appropriately. |
2 | Functional requirements above met. |
2 | (1) Comments used (2) Coding style followed (3) Appropriate variable names, constants, and data types used (4) Instructions followed |
35 | Total Points |
This assignment is due by Thursday, June 6, 2019, 11:59 PM.
As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must be provided in accordance with the course collaboration policy.
Do not forget to complete the following labs with this set: L6A,
L6B,
L6C,
L6D,
L6E,
L6F
.
Submission
Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available. The following instructions are copied from How to Submit Homework.
Submission Instructions
- File and folder names are extremely important in this process.
Please double-check carefully, to ensure things are named correctly.
- The top-level folder of your project must be named
Set6
- Inside
Set6
, create 7 sub-folders that are required for this Set. The name of each sub-folder is defined in that Set (e.g.L6A
,L6B
,L6C
,L6D
,L6E
,L6F
, andA6
). - Copy your
main.cpp
, additional header & source files () plus the
CMakeLists.txt
file into the subdirectories ofSet6
(steps 1-2), zip thisSet6
folder (steps 3-4), and then submit the zipped file (steps 5-11) to Canvas. - For example, when you zip/submit
Set6
, there will be 7 sub-folders calledL6A
,L6B
,L6C
,L6D
,L6E
,L6F
, andA6
inside theSet6
folder, and each of these sub-folders will have a file calledmain.cpp
, additional header & source files, plus the CMakeLists.txt file .
- The top-level folder of your project must be named
- Using Windows Explorer (not to be confused with Internet Explorer), find the file
named
"main.cpp"
located inside the folder for the particular lab or homework assignment you will submit.
STOP: Are you really sure you are viewing the correct assignment's folder?
- Now, for A6, right click on the
main.cpp
to copy the file. Then, return to theSet6/A6
folder and right click to paste the file. In other words, put a copy of your homework'smain.cpp
source code into theSet6/A6
folder. Repeat this for each additional header & source file you have with this assignment, plus CMakeLists.txt.
Follow the same steps for L6A, to put a copy of your lab'smain.cpp
into theSet6/L6A
folder. Repeat this process forSet6/L6B
,Set6/L6C
,Set6/L6D
,Set6/L6E
,Set6/L6F
.
STOP: Are you sure yourSet6
folder now has all your code to submit?
- Now, right-click on the
"Set6"
folder.- In the pop-up menu that opens, move the mouse
"Send to..."
and expand the sub-menu. - In the sub-menu that opens, select
"Compressed (zipped) folder"
.
STOP: Are you really sure you are zipping aSet6
folder with sub-folders that each contain amain.cpp
file in it?
- In the pop-up menu that opens, move the mouse
- After the previous step, you should now see a
"Set6.zip"
file.
- Now visit the Canvas page for this course
and click the
"Assignments"
button in the sidebar.
- Find Set6, click on it, find the
"Submit Assignment"
area, and then click the"Choose File"
button.
- Find the
"Set6.zip"
file created earlier and click the"Open"
button.
STOP: Are you really sure you are selecting the right homework assignment? Are you double-sure?
- WAIT! There's one more super-important step. Click on the blue
"Submit Assignment"
button to submit your homework.
- No, really, make sure you click the
"Submit Assignment"
button to actually submit your homework. Clicking the"Choose File"
button in the previous step kind of makes it feel like you're done, but you must click the Submit button as well! And you must allow the file time to upload before you turn off your computer!
- Canvas should say "Submitted!". Click "Submission Details" and you can download the zip file you just submitted. In other words, verify you submitted what you think you submitted!
"Set6"
folder
and only the "Set6"
folder, this zip folder must have several sub-folders, you must name all these folders correctly, you must submit the correct zip file for this
homework, and you must click the "Submit Assignment"
button. Not doing these steps is like bringing your
homework to class but forgetting to hand it in. No concessions will be made for
incorrectly submitted work. If you incorrectly submit your homework, we will not be able to
give you full credit. And that makes us unhappy. This assignment is due by Thursday, June 6, 2019, 11:59 PM.
As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must be provided in accordance with the course collaboration policy.
Do not forget to complete the following labs with this set: L6A,
L6B,
L6C,
L6D,
L6E,
L6F
.