Question

C++ Program Loop

Final task 1.png

Kids need more calcium as they get older to support their bones.

Sample Runs for task 1 :

Welcome to the program that shows the amount of daily calcium needed for kids age 1-18. 

Kids need more calcium as they get older to support their growing bones. Amount needed for kids has been listed below:

- Kids 1 to 3 years old need 1000mg of calcium a day. 

- Kids 9 to 18 years old need 1300mg of calcium a day.

Design an algorithm and write a C++ Program based on this information:


Input:

Enter Kids age: 5

Output:

Kids 5 years old need 1,000mg of calcium daily Its equal to 8 glasses of milk


0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include


using namespace std;


int main()

{

    int age;

    

    cout<<"Enter Kids age: ";

    cin>>age;

    if(age>=1 && age<9){

        cout<<"Kids "<<age<<" years old needs 1000mg of calcium daily\n";

        cout<<"Its equal to 8 glasses of milk";

    }

    else if(age>=9 && age<=18){

        cout<<"Kids "<<age<<" years old needs 1300mg of calcium daily\n";

        cout<<"Its equal to 10.4 glasses of milk";        

    }

    else{

        cout<<"Invalid age (Enter between 1-18)";

    }

    return 0;

}


answered by: Endiship
Add a comment
Know the answer?
Add Answer to:
C++ Program Loop
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Worksheet 8-3: Iron and Calcium Intakes The two minerals most likely to fall short in the...

    Worksheet 8-3: Iron and Calcium Intakes The two minerals most likely to fall short in the diet are iron and calcium. Interestingly, both are found in protein-rich foods, but not in the same foods. Meats, fish, and poultry are rich in iron but poor in calcium. Conversely, milk and milk products are rich in calcium but poor in iron. Including meat or meat alternates for iron and milk and milk products for calcium can help defend against iron deficiency and...

  • C++. You are working for the census bureau and you need to write a program to...

    C++. You are working for the census bureau and you need to write a program to do the following: A). Count the number of people in each of the following age groups: 0-18 infant, 18-29 young, 29 - 50 middle aged, 50 - 69 old, 69 - and older really old. Report the number of people in each age group. (use some random data for test). B). They need some statistics regarding the distribution of ages. Write a program to...

  • 1. Do you eat a variety of foods, including some meats, seafood, poultry, or legumes, daily? What did you eat YESTERDAY?...

    1. Do you eat a variety of foods, including some meats, seafood, poultry, or legumes, daily? What did you eat YESTERDAY? 2. Do you drink at least 3 glasses of milk—or get the equivalent in calcium—every day? How much did you drink YESTERDAY? 3. How would you obtain these minerals if you followed a vegan diet? 4. How would you obtain these minerals if you needed to restrict the protein in your diet due to kidney disease?

  • Task 1 Write a Python program that reads in any number of birth years until the...

    Task 1 Write a Python program that reads in any number of birth years until the number zero is entered. The program will then print out the average age and how old the youngest and oldest, respectively. For this task, you can start from the pseudo-code (separately) you received to get started. Example of program execution (user entries in numbers (year)): Enter year of birth. To finish, enter the number 0. Year: 1998 Year: 1932 Year: 1887 Error: Unreasonable year....

  • Write a C program which creates a template for a structure to store somebody's date of...

    Write a C program which creates a template for a structure to store somebody's date of birth (day, month, and year). Then write a C function that takes two such structure, one which represents the date of birth, and the other today's date, and returns the age of the user in years. Your function can either provide the full year only (integer) or the floating point age (bonus marks). Next, write a C program which asks the user to enter...

  • Write a program called RentalRate.java which reads in a date of birth, today’s date and a...

    Write a program called RentalRate.java which reads in a date of birth, today’s date and a male/female designation from the user, and will then determine the basic daily and weekly rates for rental of an economy class car. Rental rate classes are: Best rate (male drivers, age 33–65 and female drivers, age 30-62)--$40.00per day, $200.00 per week Risk rate 1 (female drivers, age 25–29)–Best rate plus $10.00 per day or best rate plus $55.00 per week. Risk rate 2 (male...

  • in python Write a program that reads the date of birth from the user as 3...

    in python Write a program that reads the date of birth from the user as 3 integer values (day, month, year) and then computes and prints their exact age in days. You need to take into account the leap You may not use any built-in functions related to date and time! Example: Someone born on 01/01/2000 is 365 days * 18 years + 5 days (since the years 2000, 2004, 2008, 2012, and 2016 are all leap years) + 352...

  • Visual Studio C# programming task: Every year a person has a birthday. Up until the age of 18 th...

    Visual Studio C# programming task: Every year a person has a birthday. Up until the age of 18 their parents have decided to give them the number of presents that is equal to 20 minus their age. Part 1. Create a program that asks for their age (idiot proof, must be a number that is between 1 and 18). It then calculates how many presents they should get Part 2. Improve this program to tell them how many presents they...

  • This C++ Program should be written in visual studio 2017 You are to write a program...

    This C++ Program should be written in visual studio 2017 You are to write a program that can do two things: it will help users see how long it will take to achieve a certain investment goal given an annual investment amount and an annual rate of return; also, it will help them see how long it will take to pay off a loan given a principal amount, an annual payment amount and an annual interest rate. When the user...

  • Questions: 1/Suppose that the data resulted from classifying each person in a random sample of 48...

    Questions: 1/Suppose that the data resulted from classifying each person in a random sample of 48 male students and each person in a random sample of 91 female students at a particular college. Rarely eat 3 meals a day Usually eat 3 meals a day 16 Male 32 65 Female 26 Is there any evidence that the proportions falling into each of the 2 categories are not the same for males or females? Test the relevant hypotheses with a =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT