Introduction to Computer Science Lab
Midterm
10/17/2016
1. Build a world containing a person who can calculate Einstein’s formula e =
m* C 2 in his or her head, where the user enters the m value (mass, in
kilograms), and c is the speed of light (299,792,458 meters per second).
Define descriptive variable for each quantity, and define a function to
calculate the formula. Use the world function pow() to computer C 2 . (50
points)
2. Choose a hopping animal from Alice Gallery (for example, a frog, a bunny,
etc.). Write a hop() method that makes it hop in a realistic fashion, with a
parameter that lets the sender of the message specify how far the animal
should hop. Using your hop() method, have your animal hop around a
building in four hops. (50 points)
Present your Alice code to the instructor, and submit them to Ecourse.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |