MECH 215 Study Guide - Midterm Guide: Call Graph, Maybelline, Function Prototype

187 views7 pages
1
Instructor: Tadeusz S. Obuchowicz
Date: Friday, March 6, 2009
Time Allowed: 1 hour and 30 minutes
Material Allowed: Any C++ textbook, course notes. NO laptaps allowed. ENCS approved
electronic calculators. Pencils, pens, erasers, rulers.
Instructions: Answer all 4 questions in the answer books provided. If you make any assumptions,
clearly indicate so in your answer booklet.
Question 1: [25 points]
In a country far, far, away during a time long, long ago there lived a king called Keith. Keith
ruled Stonesland and serenaded the people living in this idyllic land with his guitar playing. The
currency used in Stonesland consisted of the following coins: a STONE, a KEITH, a MICK,
and a RON (listed in DECREASING order of monetary value, refer to Figure 1).
Figure 1: The coins used in Stonesland.
The relationship among these coins was decided by the King Keith (quite arbitrarily) to be:
1 STONE = 15 KEITHS
1 KEITH = 20 MICKS
1 MICK = 12 RONS
1 RON = 1 RON ( a RON is sort of like a penny, it is worth the least amount and people keep
throwing them onto the streets of Stonesland much to the annoyance of the King ...)
Write a complete C++ program which will ask the user to input the number of STONE coins, the
number of KEITH coins, the number of MICK coins, and the number of RON coins that she has
in her pocket. The program will then display total value represented by these coins using the
LEAST amount of coins. Typical interaction with the program would be similar to:
"Mick only
sings." 1 RON
1 MICK
1 STONE
1 KEITH
Rock’n
Roll
trust"
"In Keith we
Fender Telecaster
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 7 pages and 3 million more documents.

Already have an account? Log in
2
ted@brownsugar Programs 7:54pm >stones_currency
Enter the amount of STONES that you have 2
Enter the amount of KEITHS that you have 12
Enter the amount of MICKS that you have 68
Enter the amount RONS that you have 258
The amount you have entered is equivalent to 3 STONES and 1 KEITHS
and 9 MICKS and 6 RONS.
ted@brownsugar Programs 7:54pm >
Hint: Make use of while loops.
Another Hint: Look at the picture below...
Figure 2: 15 RON coins is equal to 1 MICK coin and 3 RON coins.
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
1 RON
Fender Telecaster
"Mick only
sings."
1 MICK
1 RON
Fender Telecaster
1
5
R
O
N
S
is equal to 1 MICK and 3 RONS
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 7 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers