5.1: Exercise Competition:
Three girls Jenny, Kelly, and Barb are enrolled in an exercise class. One day after class the three decide to have a friendly competition to see how many sets of 10 repetitions of running in place each can do before getting tired. Barb decides to go first and gets tired at 10 repetitions. Kelly goes next and she gets tired at 20 repetitions. Jenny, who has been in the exercise class for the longest, goes next. She gets tired at 30 repetitions.
Create a world that suites the competition.
- Note: Basically, you are just using a parameter to determine how many times the girl “runsInPlace”
- Important: Each of the girls should be an instance of
ExerciseGirlclass that you created in chapter 5.
EACH Assignment below requires the use of a parameter in some way. If you do not have a parameter, as described, you will lose a lot of credit.
5.2 : Jumping Jacks
jumpingJack method to the
ExerciseGirl class. The method should make the object perform jumping jacks .
- Important: this method should have a parameter for the number of repetitions to perform.
5.3 : Marcello The Magician:
Marcello the magician has finally mastered his disappearing act. To perform the act, he places several items on a table in front of him. He stands with his right arm extended over an item. He says the magic word “Alakazam, Alakazee” and the object disappears. He repeats this procedure for each object on the table. Create a world in which Marcello (an instance of the Magician class from the People Collection) demonstrates his new act . In the magician object
- you should create two new class-level methods:
- should cause Marcello to say the magic words.
- This method should have an object as its parameter
- should cause Marcello to turn to face the object, say the magic words (by calling the sayMagicWords method) and then make the object disappear by setting its opacity to zero (note: for some reason the bunny object cannot be made to disappear this way!).
- This method should have an object as its parameter
- the object should be made to 5 times its original size!
- Want to get an “A+”: then create a transmute method tha
- takes an object parameter
- Changes a locust to a boar (hide the one , make the other appear)
- changes a bird to a locust
We are going to create a variable numWins to keep track of how many times the user correctly beats the cpu.
- create a variable numWins to keep track of how many times the user correctly beats the cpu
- Every time that the user wins increment the variable by adding 1 on to that variable.
This is how you increase the value of a variable by 1.
- Repeat this step for each in which the user wins.
- At the end of each round, tell the user how many times they won. (Remember that numWins is a number so you must use what as a string to say it)
In the Part 2, we ended with a dilemma. If the user wants to play a second game, we need hide the objects that were chosen in the first game!
- So, at the start of the main while loop, you should programmatically set the isShowing of all 6 objects to false.
Note: all commands in alice have a duration. Since we want all 6 objects to immediately hide, s et the duration to 0 by clicking on more and selection duration as shown below:
So, now you should have a fully functional Rock, Paper, Scissors Game that should work similar to what you can see below (Still, there are some improvements that could be made ,see the bottom).
However, there are some improvements that we should make.
Improvement #1 : Keep track of how many times the user beats the computer. (required)
1 Create a variable called userChoice
2. Use the world ask user for a number function to store the user’s choice into that variable (Note: if the user chooses a number larger than 3 or less than 1 then they entered an invalid number, something to think about
3. Set the isShowing property of all 3 objects to be false . We will set the visibility to true , when the user chooses that object , later on .
Objective; If the user chooses rock, we need to show a rock; if the user chooses scissors, show a scissors, and the same for paper.
Use if/else and the value of userChoice and set the isShowing of either the rock , the paper or the scissors to true
Run through the program a few times. What should we do next ?
We need to show what the CPU chooses!!
So, now we need to do a few things:
A) edit our if/else to consider what the user chose and what the cpu randomly chose (both/and)
B) add a second rock, paper and scissors object that represents the CPU’s choice
(note: I set the color of the CPU’s objects to red so I can more easily distinguish the cpu’s from the user choice’s objects)
C) Set isShowing to false for each of the cpuChoice’s objects
5. State who won the round or if the round was a draw :
7. The last line of your loop should ask the user if they want to play again.
Try playing the game a few times. You will notice that there is a problem, when you play multiple times
Can you see what is wrong with our current setup? The bug only applies to multiple games. If you play a single game and close Alice, you will not notice the problem.
As you can see above, when you start a second game, you can still see the rock and paper that were chosen in the first game.
Can you figure out how to fix the problem?
Become an expert on your topic. Explain
- any unethical acts
- what laws, if any , were broken
- what government agency was involved
- what consequences did that party (person or business) suffer
Format: Powerpoint 5-7 slides
Vokswagon Emissions Scandal
Valeant drug scandal
Zenefits Insurance Scandal
Taken from https://teals-introcs.gitbooks.io/2nd-semester-introduction-to-computer-science-pri/units/1_unit/06_lesson/project.html
Overview: Using Python, students will use variables, input, and printing to create a Mad Lib. You will also practice designing a project by planning out your Mad Lib before implementing it. Part of the project is to use your creativity to design your own unique story.
The program will print out the title of the Mad Libs story, as well as a short explanation of game play
A Day in NYC: a Mad Lib.
Welcome! You are about to play a fantastic word game.
I will ask you for nouns, verbs, adjectives, proper nouns and adverbs.
Using those words I will create an unexpected story for you!
The program should then prompt the user to enter in nouns, verbs, adjectives, proper nouns, and adverbs
Plan out your story on pencil and paper first, before you start implementing the program.
- Create your story
- Select the missing words
- Determine each words part of speech
- Create introduction
- Create questions
- Divide story into print statements
As mentioned above the program must request words from the user. The following must be included in the program:
- 10 different words inputted
- Variable names should correspond to the part of speech requested and part of the story they belong to (e.g.
- You may only use 3 print statements to tell your story
|Program greets user and explains rules||3|
|Program accurately requests 10 words (1 for word, 1 for correct request)||20|
|Program prints full Mad Lib||10|
|Program exhibits creativity||3|
|Program utilizes variable names to convey meaning||5|
|Correct order of inputted words||10|
|Only 3 print statements||10|