Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help with this please!

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with this please!

    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.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Help with this please!

    First step would be to work out the equations and formulas needed to solve the problem.
    If you don't understand my answer, don't ignore it, ask a question.