More exercises

Base your code on the tip calculator and animal sounds examples.

Here’s a tip on how to add a Run button. Remember to save your Excel file as an XLSM.

Exercise: How many tires?
Write a program that computes the number of tires you have, given the number of bikes (2 tires) and cars (4 tires) you have. For example:

Sample output

As always: comments, good variable names, etc.

Upload your solution.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Exercise: Who won?
Write a program to show who won a contest. Was it the good guys, the bad guys, or a draw?

The user inputs scores, and clicks a button. The program shows one of three messages:

  • Yay! Good guys won!
  • Boo! Bad guys won.
  • A draw. We’ll get them next time.

For example:

Output

As always: comments, good variable names, etc.

Upload your Excel file.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Exercise: Character classes
RPGs are role playing games, like Zelda, and Final Fantasy. RPG characters often have a class, like fighter, thief, or wizard.

Write a program that shows the base attributes of character classes. The user types in a class – fighter, thief, or wizard – and the program shows the attribute scores for strength, stealth, and magic. For example:

Example

Use this table:

Class Strength Stealth Magic
Fighter 7 4 4
Thief 4 7 4
Wizard 4 4 7

As always: comments, good variable names, etc.

Hints:

Upload your Excel file.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)