CSCI 261 - Programming Concepts (C++)Spring 2017 - Assignment 07 - CalculatorQuick Links: Blackboard | Canvas | CS @ Mines | Cloud9 | Piazza | zyBooks |
|||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | |||||||||
This assignment is due
by Tuesday, March 14, 2017 11:59pm.
InstructionsOne common application for simple
programs is to perform conversions or calculations for the user. In
this homework assignment, you will write a program that gives the user
a few choices for calculations. Specifically, you will write functions
to calculate someone's Body Mass Index (BMI), convert from pounds to
kilograms, convert from feet to meters, and one additional calculation
of your choice.
For each calculation in your program,
you should write (at least) two functions. One function should perform
the calculation and return the result, and the other function should
accept necessary data from the user, call the calculation function, and
then display the result. You should also have a menu function which
presents the user with the possible choices for calculations (e.g.,
user can choose BMI calculation or convert from pounds to kilograms).
Why do we divide your program into
functions this way? The primary reason for using functions is so that
code is more easily identified and reused. This division ensures that
your calculation is universal and can be reused elsewhere.
Get Started
To begin, create an empty project. For the
main()
, copy/paste the following into your homework project.
int main() {
Note that the main function calls a
// DO NOT change this main function menu(); return 0; } // end of Main Function menu
function, which you need to write. Note also that you are not allowed
to change the main function. Thus, your
menu
function will need to call another function which is associated with
the calculation chosen by the user. Fortunately, calling a function
from another function works the same way as calling a function from
main (as main is also a function).
You should place your function definitions below your
main()
. To do that, think about what you need to add above your
main()
to give your functions global scope that can be called from everywhere.
(We will discuss function prototypes on Friday.)
The FunctionsYour program must have the following
functions that perform the described tasks:
Grading Rubric
Your submission will be graded according to the following rubric.
Submission
Always, always, ALWAYS update the
header comments at the top of your main.cpp file. And if you ever get
stuck, remember that there is LOTS of help
available.
In summary, for homework due on
Tuesday, March 14 follow these specific steps:
This assignment is due
by Tuesday, March 14, 2017 11:59pm.
| |||||||||
Last Updated: 01/01/70 00:00
|