/*	
	Assignment 2 Question 3
	Group 11 
	Name:
	1. MD MAHI ANAN
	2. TAY WEI JIAN
	3. SAMUEL LUK KIE LIANG
	This program is used to tell the consumer about the amount of the nutrient in the product is low, moderate or high
*/
	
#include <iostream>
using namespace std;
float getDV(float, float);
string getStatus(float);

int main()
{
	float DV_percentage, nut_amount, rec_value;
	// DV_percentage is % Daily Value, nut_amount is nutrient amount, rec_value is total daily recommended value
	string level;
	// level is the level of amount of this nutrient in this product
	char cont;
	// cont is used to checking for continue receive another input or not
	
	do
	{
		cout << "Please enter amounts of nutrients in one serving: ";
		cin >> nut_amount;
		
		cout << "Please enter amounts of nutrients recommended per day for individuals 4 years of age and older: ";
		cin >> rec_value;
		
		DV_percentage = getDV(nut_amount, rec_value);
		level = getStatus(DV_percentage);
		
		cout << "The amount of this nutrient is " << level << " in this product" << endl << endl;
		
		cout << "Continue or Exit (Continue = Y, Exit = Other Alphabet): ";
		cin >> cont;
		cout << endl;
		
	}
	while (cont == 'Y' || cont == 'y');
	
	return 0;
}

// getDV is used to calculate daily value
float getDV(float amount, float recommended)
{
	return (amount / recommended * 100);
}

// getStatus is used to determine the amount of the nutrient in the product
string getStatus(float DV)
{
	if (DV <= 5)
	{
		return "low";
	}
	else if (DV >= 20)
	{
		return "high";
	}
	else
	{
		return "moderate";
	}
}
