Purchase Solution

C++ sports activity scheduling program

Not what you're looking for?

Ask Custom Question

You are running a camp and must decide what activities to schedule. You decide to base the decision on the temperature measured in degrees Fahrenheit. If the temperature is above 85°, you schedule swimming. If the temperature is above 70° and less than or equal to 85°, you schedule baseball. If the temperature is above 32° and less than or equal to 70°, you schedule basketball. Finally, if the temperature is below 32°,you send everyone home.

Create a C++ program that takes temperature as input and provides as output your sports decision. Assume that temperatures are only expressed as integers. In the program, include 2 void functions titled getTemp and printActivity, each with an int argument.

- The function getTemp should have a Reference parameter that gets the temperature in getTemp and then passes the value back to be printed in main( ), and
- printActivity should have a Value parameter.

The function getTemp should prompt the user for the temperature in Fahrenheit, get the input from the user, and return to main( ) where it prints the temperature on the screen. The function printActivity should determine the activity and print it as output on the screen. Be careful and note that this problem requires you to input the temperature into getTemp and not directly into the main function.

Purchase this Solution

Solution Summary

The solution sticks to the specification and explains in brief where mistake could creep in when addressing this question. It also provides an equivalent nested-if implementation of printActivity function for better understanding of printActivity function.

Solution Preview

Please note that the given question does not specify any action when temperature is 32 degree Fahrenheit. Attached program (566646.cpp) captures this fact by indicating that no action was specified for this temperature value. You should edit it out in case you do not want it.

A simple edit would be ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.