42.5k views
20 votes
Energy Drink Consumption A soft drink company recently surveyed 16,500 of its customers and found that approximately 15 percent of those surveyed purchase one or more energy drinks per week. Of those customers who purchase energy drinks, approximately 58 percent of them prefer citrus-flavored energy drinks. Write a program that displays the following: The approximate number of customers in the survey who purchase one or more energy drinks per week The approximate number of customers in the survey who prefer citrus-flavored energy drinks.

1 Answer

10 votes

Answer:

Follows are the code to this question:

#include <iostream>//header file

using namespace std;

int main()//defining a main method

{

int customer= 16508;//defining an integer variable

int E_drink, C_drink;//defining an integer variable

double buy_Energy_drink,buy_cold_drink;//defining a double variable

buy_Energy_drink= 0.15;//use double variable to assign value

buy_cold_drink= buy_Energy_drink *0.58;//use double variable to calculate value

E_drink = customer*buy_Energy_drink;//calculating value of E_drink

C_drink= customer*buy_cold_drink;//calculating value of E_drink

cout<<"\t\t\t -:Energy Drink Consumption:-"<<endl;//print message

cout<<"According to A soft drink company surveyed 16,500 of its customers."<<endl;//print message

cout<<E_drink <<" customer purchase one or more energy drinks per week."<<endl;//print message with value

cout<<C_drink <<" customer who prefer citrus-flavored energy drinks."<<endl;//print message with value

return 0;

}

Output:

Please find the attached file.

Step-by-step explanation:

In this code, three integer variable "customer, E_drink, and C_drink" is defined, in which the first variable is used to hold a value, and the next two variables are used for calculating the value.

In the next step, two double variables "buy_Energy_drink, buy_cold_drink" is defined that calculate the given percentage value and passed into the integer variable to calculate the value and print the value with the given message.

Energy Drink Consumption A soft drink company recently surveyed 16,500 of its customers-example-1
User Sarjerao Ghadage
by
3.8k points