File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Programming-Challenges/Fundamentals
out/production/Programming-Challenges/com/challenges Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments