Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
You are not logged in. Go to Login page. You need to login before you can view more content. (content omitted that requires login)
4. Stem and leaf plot
5. Functional requirements
You are given the following data as a JSON dictionary.
A name for that work.
The maximum score for a work.
A list of scores for that work.
The score of the student for which this plot is generated.
Bucket size.
All data points are integer values.
You are to compute and output the following.
A stem and leaf plot of the data, in text format, as per the example.
6. Non-functional requirements
All the code should be in the one source file.
Do not access external files for read or write. All input comes from the standard input and all output goes to the standard output.
In Pythons, this means do not use modules, but you can use classes and standard (not your own) external libraries that are part of the standard Python installation.
7. Domain knowledge
Domain knowledge is the background knowledge that is useful in solving a problem, designing a solution, implementing the solution, etc.
You are provided with the following starter program in file stemleaf.py.
Do not remove any comment that starts with two hash signs.
Here is the Python code.
You are to fill in the missing parts of the program according to the work requirements (see above).
In the comments at the top, you are to fill in the author (your name), help received (person and type of help), and pseudo-code parts which are not in the solution (usually provided, but you need to add them). Remove the parentheses too.
10. Possible solution
Begin solution
Here is a possible solution to the above problem. Note: Once a solution is provided, or the day before the next class, further submissions for this work receive no credit.
End solution
11. Examples of input and output
Here are some examples of input and output for the above program code.
Here is an example input from file input1.txt.
For the above example input, here is the expected output.
12. Hints
Hints will be added here as issues are encountered or anticipated.
When doing floating point computations using integers, it is best to explicitly convert every integer to a float. So write integer literals such as 123 as 123.0 and convert integer variables such as i1 to float(i1).
One way to round (for positive numbers) a float value f1 to an integer is to use the expression int(f1+0.5).
13. Pseudo-code
The pseudo-code should be only for the stem-and-leaf algorithm used.
14. Suggested iterative development
Here is one possible iterative development.
Output all the sorted scores from high to low.
Output all the sorted percents from high to low.
Output all the sorted percents from high to low, with displayed cutoff.
Add a way to break to the next line at cutoffs, adding the interval at the start of the line.
15. Scoring rubric
CS 496 - A2 : Asmt#2: Stem and leaf plot
Your grade: _ / 30
[LATE] Late or redo penalty: _ / -30
[SUBMIT] Not submitted properly: _ / -30
[RUN] Does not compile, run-time crash, etc.: _ / -30
[ETHICS] Ethical issues: _ / -30
[HEADER] Header comments not done as required: _ / -15
[STYLE] Inconsistant style or indentation: _ / -15
[CODE] Code guidelines ignored: _ / -30
[XCODE] Code used not yet covered: _ / -15
[REMOVED] Triple slash comments removed: _ / -15
[ADDED] Code added outside of marked areas: _ / -15
[OUTPUT] Functional requirements met: _ / 30
[CREDIT] Extra credit: _ / +6
Comments: