|CS 120 01/ Zelle||Fall 2017|
This is the in-class lab from Friday 9/8. If you did it in class, you are good to go.
Answer the true/false and multiple choice questions at the end of Chapter 1. Your answers should be written out on paper suitable for hand in and the beginning of class.
You are to do exercise 6 on page 25. You are to compare three modifications of the chaos program. Please note that exercise 6 asks you to discuss the results you see. You should put some comments (using # at the front of each line) at either the beginning or end of the program to describe what you saw and speculate why you think it happened. You should turn in the last version of your program (part c) on Manhattan VC (socrates.wartburg.edu).
Answer the true/false and multiple choice questions at the end of Chapter 2. Your answers should be written out on paper suitable for hand in and the beginning of class.
Programming exercise #11 on page 55. To score full points, your conversion must be "interesting." It's a judgement call on my part, but "feet to inches" is not interesting. Turn in on Socrates.
Programming exercise #7 on p. 55. You can check your program with the following example:
Suppose you invest $100 a year for 3 years at 5% interest.As noted in class, you will need two separate variables to represent the amount invested each year and the principal (total amount accumulated). The principal can start a $0.
After 1 year you will have 1.05(100) = $105.
After 2 years the amount will be 1.05(105+100) = $215.25.
After 3 years, the amount will be 1.05(215.25+100) = $331.0125
The program should print out that final amount, $331.0125
Do the T/F and multiple choice questions for Chapter 3. Have them on paper ready to hand-in at the start of class. We will spend most of class as a lab day practicing this content.
Do exercise #9 on page 81.
Do either exercise 15 or exercise 17 from page 82.
Do programming exercise #3 from p. 126.
Do the T/F and multiple choice questions for Chapter 4. Have them on paper ready to hand-in at the start of class.
Programming exercise #11 on page 128. For full credit, add some extra feature to make the house even more interesting.
Do discussion questions 2 and 3 on page 170 on paper. You may check your answers using a computer, but make a good faith effort to write out an answer before checking on the computer. Make note of any results that surprise you.
You can just skim Section 5.8.
Programming Exercise 4 on page 171.
The is part 5 of the files program lab. You should create some simple test files to try our your program (you can submit them along with your program). I will give bonus points for interesting scenes. When you program is working, try it out on this file: fallscene.txt.
Do the T/F and multiple choice questions from the end of Chapter 6.
Part 4 of the Function Fun lab.
Read Chapter 7 and do the T/F and multiple choice questions at the end.
Pig Latin is a silly code language. A word is translated to Pig latin by taking all the consonants up to the first vowel off of the front of the word and appending then to the end followed by "ay". For example, "hello" becomes "ellohay". If a word starts with a vowel, a "w" is appended to the end of the word before the "ay".
A sentence or phrase is translated into pig latin by translating each word separately. For example, "Don't talk in front of the kids" becomes: "On'tday alktay inway ontfray ofway ethay idskay." You are to write a program that accepts a sentence of input from the user and outputs the sentence translated into Pig Latin (PL).
if letter.lower() in "aeiouy":
translatePhrase(phrase) --> PL version of entire phrase tanslateWord(word) --> PL translation of a single word firstVowel(word) --> position (index) of first vowel in word
Do the T/F and multiple choice questions for Chapter 8. Have them on paper ready to hand-in at the start of class.
This assignment is based on programming exercise #4 on page 280 and problem #6 on the Decisions and Functions Lab. Your program should have 2 helper functions (as described in the lab parts 5 and 6). The main program should ask the user for the starting number of a Syracuse sequence and then compute the sequence. The program will then print out summary information about the sequence, namely its length and the maximum value attained. Finally, the program will ask the user whether her or she would like to see the sequence, if the answer is "yes", the program will print all of the values in the sequence.
For example, the output might look something like this (user input is bolded):
This program computes a Syracuse sequence. Enter an integer greater than 0 to start the sequence: 10 The length of the sequence is: 7 The maximum value is: 16 Would you like to see the sequence? y 10 5 16 8 4 2 1
Do the T/F and multiple choice questions for Chapter 9. Have them on paper ready to hand-in at the start of class.
Modify the racquetball simulation from chapter 9 for table tennis (ping pong). You can find the modern rules here. Your simulation need only simulate at the game level. Bonus points for extending to a best-of-n games matches.
Pay special attention to the widgets (roller.py) and animation examples.
Do the T/F and multiple choice questions for Chapter 10. Have them on paper ready to hand-in at the start of class.
Part 5 of the Obejcts Lab.