Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: In a mobile health app that tracks the daily water intake of its users, the users are encouraged to reach a daily goal of

Assignment: In a mobile health app that tracks the daily water intake of its users, the users are encouraged to reach a daily goal of water consumption for better hydration. The user's current water intake is stored in an integer variable currentIntake, measured in milliliters. If the user reaches the goal, the app awards points to their health score (stored in the variable healthScore and displays a motivational message. In addition to this, the app also tracks how many days a user has hit their goal in the variable daysHitGoal.
Write the correct if statement that does the following if currentIntake exceeds 2000 milliliters (the daily goal):
Adds 5 points to healthScore.
Adds 1 to daysHitGoal.
Prints a message to standard output congratulating the user for achieving their daily hydration goal.
The message should read "Congratulations! You reached your daily goal!"
Note: You must write the statement to check for the condition and the assignment of the correct value. Assume that you can use the std namespace objects freely.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

Did you print a proof to view color and image consistency?

Answered: 1 week ago