Hey guys, I have to write a small java program for uni.
The aim of the program is to calculate a total number of energy drinks consumed per week by under 65's and above 65's. The sample my lecturer has given me is below;
//states total population final int POPULATION = 22926028; /states % of population that are above 65 final double OVER_65_PERCENT = 15/100.0; //states that 20% of under 65s drink 1 drink per week final double UNDER_65_1_PER_WEEK = 20/100.0; //states that 10% of under 65s drink 2 per week final double UNDER_65_2_PER_WEEK = 10/100.0; //states that 5% of under 65s drink 3 per week final double UNDER_65_3_PER_WEEK = 5/100.0; //states that 2% of over 65s drink 1 per week final double OVER_65_1_PER_WEEK = 2/100.0; //states that 1% of over 65s drink 2 per week final double OVER_65_2_PER_WEEK = 1/100.0; //states that 0% of under 65s drink 3 per week final double OVER_65_3_PER_WEEK = 0/100.0; // calculate how many over 65 and under 65 int populationOver65 = (int)(OVER_65_PERCENT*POPULATION); int populationUnder65 = POPULATION-populationOver65;
Some extra constants have been added to represent the additional data, and these
have been used to calculate two different population figures. I need to know how I can modify
rest of the calculations to use these two population figures and work out the
total.
This is all assuming that;
There are currently about 15% over 65’s in Australia. Of these, about 2% drink 1
energy drink per week, 1% drink 2, and close enough to 0% drink 3.
Australia’s population is about 22,926,028. About 20% of Australians drink 1 energy
drink per week, 10% drink 2, and 5% drink 3.
Any help would be greatly appreciated.