Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Assignment

When writing C++ programs include comments in your code, make the program readable by indenting, use meaningful variable and function names, and produce meaningful output.

This assignment will be to write a bmi calculation program that interacts with the end user - using the guidelines and sample output below.

Program: 20 points - bmi.cpp

Write a program that will do the following:

? Write a main function that will use a FOR LOOP - define a constant integer TOTAL_PEOPLE equal to 4. Use this constant to control how many times your FOR LOOP loops. Within the FOR LOOP you will be calling each of the following functions you will write.

? Write a function that will prompt for the current person's weight in pounds and return that weight..

? Write a function that will prompt for the current person's height in FEET and INCHES and return total height in INCHES.

? Write a function that will calculate and return the current person's BMI

? BMI Formula = (pounds*703) / (inches * inches)

? If your pounds and inches are defined as integers instead of doubles, you will need to multiply them by 1.0 in the above formula to make them be treated as real numbers for the division (otherwise it will do integer division)

? Write a function that will calculate and return the BMI classification string based on the calculated BMI.

? (-infinity, 18.5)   "Underweight"
? [18.5, 25)          "Normal weight"
? [25, 30)             "Overweight"
? [30, +infinity)     "Obesity"

? Write a function that will print the results of the BMI function and the BMI classification. In this function when you print the BMI value use the cout formatting options fixed and setprecision(2) to properly display only 2 decimal places for the BMI value.

? Use the examples below to run your program with - you should get the same results.

Remember to write this in baby steps compiling a little bit at a time - do not try to write all the functions at once and run it, it is much easier to troubleshoot by adding only a few lines of code and compile to see how that works. For example on this program - write main first with no other functions - get main working with a for loop, that loops 4 times

-- use testing/debugging cout statements to prove that your loop is looping 4 times. Next create the function get_weight, call this function inside your for loop, you should see that it prompts you 4 times to enter the weight - put testing/debugging cout statement in main to prove that you correct prompted and returned back to main the weight. Do this same step of adding one function at a time and testing/debugging as you go --- add a few (1-9) lines not 10's/100's of lines before you compile and check what you just added, if you have a problem it is most likely in those last few lines of code you just added/changed.

Example program run:

Enter weight in pounds for person #1 : 138 Enter height (feet and inches) for person #1 : 6 2

Person #1 weighs 138 pounds and is 74 inches tall with a calculated BMI of 17.72 and a classification of: Underweight

Enter weight in pounds for person #2 : 175 Enter height (feet and inches) for person #2 : 5 9

Person #2 weighs 175 pounds and is 69 inches tall with a calculated BMI of 25.84 and a classification of: Overweight

Enter weight in pounds for person #3 : 245 Enter height (feet and inches) for person #3 : 6 0
Person #3 weighs 245 pounds and is 72 inches tall with a calculated BMI of 33.22 and a classification of: Obesity

Enter weight in pounds for person #4 : 142 Enter height (feet and inches) for person #4 : 5 4

Person #4 weighs 142 pounds and is 64 inches tall with a calculated BMI of 24.37 and a classification of: Normal weight

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92074889
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in C/C++

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As