Skip to content

Commit 0776ea0

Browse files
Energy Drink Consumption
1 parent 5255098 commit 0776ea0

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
A soft drink company recently surveyed 12,467 of its customers and found that
3+
approximately 14 percent of those surveyed purchase one or more energy drinks per week.
4+
Of those customers who purchase energy drinks, approximately 64 percent of them prefer citrus-flavored energy drinks.
5+
Write a program that displays the following:
6+
• The approximate number of customers in the survey who purchase one or more energy drinks per week
7+
• The approximate number of customers in the survey who prefer citrus-flavored energy drinks
8+
9+
*/
10+
11+
package com.challenges;
12+
13+
public class EnergyDrinkConsumption {
14+
public static void main(String [] args) {
15+
16+
// Declare Variables
17+
int noOfCustomers = 12467;
18+
final double REGULAR_CONSUMER_PERCENTAGE = 0.14;
19+
final double CITRUS_CONSUMER_PERCENTAGE = 0.64;
20+
double totalRegularConsumers;
21+
double totalCitrusConsumer;
22+
23+
totalRegularConsumers = noOfCustomers * REGULAR_CONSUMER_PERCENTAGE;
24+
totalCitrusConsumer = totalRegularConsumers * CITRUS_CONSUMER_PERCENTAGE;
25+
26+
System.out.println("Total number of customers surveyed: " + noOfCustomers);
27+
System.out.println("Approximate number of regular customers: " + (int)totalRegularConsumers);
28+
System.out.println("Approximate number of citrus consumers: " + (int)totalCitrusConsumer);
29+
}
30+
}

0 commit comments

Comments
 (0)