Sale!

CSCI 1133 Programming Examination 1 solved

Original price was: $35.00.Current price is: $30.00.

Download Details:

  • Name: project01-8kclrw.zip
  • Type: zip
  • Size: 222.17 KB

Category:

Description

5/5 - (1 vote)

CSCI 1133 Programming Examination 1

Part 1 (10 points)

Using a text editor, type the following academic integrity pledge (exactly as it appears), replacing the last line
with your full name and X500 ID. Save the text file with the name academicpledge.txt and
commit/push it to your GitHub examination repository:

If you do not commit and push the academicpledge.txt file prior to the deadline for Part 2, your entire
examination solution will not be graded, resulting in a score of zero. In order to receive the 10 points for Part 1,
you must submit the pledge file to your exam repository prior to the deadline for part 1.

Part 2 (90 points)

Using Turtle graphics, write a well-structured Python program that will input a string of any length and count
the occurrence of each of the vowels in the string: a, e, i, o and u (consider y a consonant in all cases). For
example, in the string:

“My mama’s llama pajamas are definitely not cool, especially when worn in public”
the letter a occurs 9 times, e, 6 times, i, 5 times, o, 4 times and u exactly once. Note that the vowel count is
case “insensitive”, i.e. the characters ‘E’ and ‘e’ represent the same vowel.
In order to “visualize” the distribution, your program will construct and display a proportional “pie chart”
using Turtle graphics, e.g.,

Requirements:

Your program must do the following:
• Use turtle graphics to implement the graphical interface.
• Solicit an input string using the turtle .textinput()function.
• Include a pure function named vowelCount(astring) that takes a single string argument,
determines the individual vowel frequencies and returns the counts in a Python list, each list element
corresponding to the vowels: a, e, i, o and u in order.

• Include another non-pure function named pieChart(flist) that will accept a list of frequency
counts and draw a colored pie chart as shown above. Note that in a “pie chart”, the area of each colored
wedge proportionately represents the frequency value. You may use any colors you wish.

• You can find descriptions of the .textinput()and.write()turtle functions (along with all the
Turtle graphics module functions) here: docs.python.org/3/library/turtle.html .
• Use the turtle.hideturtle() method to hide the turtle.

CSCI 1133 Programming Examination 1

Constraints:

• You may use any built-in Python object class methods (string, list, etc.)
• You may use imported functions and class methods from the turtle and math modules only
• You may use any built-in Python functions/operations as appropriate, with the exception of input()
and print() which will not work with a graphical display environment.

Submission Instructions

Store all of your source code in a single module named piechart.py Make sure your files are named
correctly! Missing or misnamed submissions will not be graded and will result in a grade of zero.
Commit/push your source file to your exam repository prior to the deadline for Part 2.

Helpful Hints:

• You will find this project much easier if you employ the principles of “top-down, functional
decomposition” as discussed in lecture and implement your program as a collection of short, simple
functions. For example, you might consider a separate function for drawing each “wedge” of the pie
chart.
• A “proportional” scale implies that individual counts are normalized so that they sum to 1. e.g., for the
following list of frequency values:
2 , 4, 6

the first value represents 2/12 of the total count, the second value represents 4/12 of the total count and
the third value represents 6/12 of the total count. Note that this scale is easily determined by dividing
each of the counts by the total count.

CSCI 1133 Programming Examination 1