subject
Engineering, 14.03.2020 00:27 zacksoccer6937

A soft drink company recently surveyed 12,467 of its customers and found that approximately 14 percent of those surveyed purchase one or more energy drinks per week. Of those customers who purchase energy drinks, approximately 64 percent of them prefer citrus-flavored energy drinks. Write a Java 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.

This is what I have so far and it runs with no errors but my numbers being displayed at the end are not mathematically correct or look like they're in the right decimal format...Can't figure out what exactly needs to be changed.. Also what would be another datatype I could use for customers, as I realize they're not going to be a half.



public class Ex2_15 {
private double customers;
private double thoseThatPurch;
private double preferCitrus;
private double nopeople1;
private double nopeople2;

public Ex2_15()
{
customers = 12467;
thoseThatPurch = 14;
preferCitrus = 64;
}

public Ex2_15(double customers, double thoseThatPurch, double preferCitrus) {
this. customers = customers;
this. thoseThatPurch = thoseThatPurch;
this. preferCitrus = preferCitrus;
}

public void printOutput()
{
nopeople1 = customers * thoseThatPurch;
nopeople2 = nopeople1 * preferCitrus;

System. out. println("");
System. out. println("ENERGY DRINK CONSUMPTION");
System. out. println("");
System. out. println("Number of people surveyed: " + customers);
System. out. println("Number who purchase one or more energy drinks: " + nopeople1);
System. out. println("Number who prefer citrus flavored energy drinks: " + nopeople2);
System. out. println();
}

public static void main(String args[]) {
Ex2_15 edc1 = new Ex2_15();
Ex2_15 edc2 = new Ex2_15(12467.0,14.0,64.0);
edc1.printOutput();
edc2.printOutput();
}
}



END RESULT :


ENERGY DRINK CONSUMPTION

Number of people surveyed: 12467.0
Number who purchase one or more energy drinks: 174538.0
Number who prefer citrus flavored energy drinks: 1.1170432E7


ENERGY DRINK CONSUMPTION

Number of people surveyed: 12467.0
Number who purchase one or more energy drinks: 174538.0
Number who prefer citrus flavored energy drinks: 1.1170432E7

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26°c with a volumetric flow rate of 0.18 m3/s. refrigerant exits at 9 bar, 70°c. changes in kinetic and potential energy from inlet to exit can be ignored. determine the volumetric flow rate at the exit, in m3/s, and the compressor power, in kw.
Answers: 1
question
Engineering, 04.07.2019 18:10
Water in a partially filled large tank is to be supplied to the roof top, which is 8 m above the water level in the tank, through a 2.2-cm-internal-diameter pipe by maintaining a constant air pressure of 300 kpa (gage) in the tank. if the head loss in the piping is 2 m of water, determine the discharge rate of the supply of water to the roof top in liters per second.
Answers: 3
question
Engineering, 04.07.2019 18:10
Awall of 0.5m thickness is to be constructed from a material which has average thermal conductivity of 1.4 w/mk. the wall is to be insulated with a material having an average thermal conductivity of 0.35 w/mk so that heat loss per square meter shall not exceed 1450 w. assume inner wall surface temperature of 1200°c and outer surface temperature of the insulation to be 15°c. calculate the thickness of insulation required.
Answers: 3
question
Engineering, 04.07.2019 18:20
Find the minimum film thickness for a journal bearing with the data below. shaft diameter, d-50 mm, clearance ratio, cdratio? 0.001, shaft speed, n 2000 rpm; bearing length. i 200 mm; eccentricity ration, ? -0.55. ( note, cdratio-ca/d) the minimum film thickness is um
Answers: 2
You know the right answer?
A soft drink company recently surveyed 12,467 of its customers and found that approximately 14 perce...
Questions
question
Mathematics, 01.08.2019 04:30
question
Geography, 01.08.2019 04:30
Questions on the website: 13722361