[OTHER] Java Project Ap Computer Science

Discussion in 'Programming & Scripting' started by Sean_J, Feb 5, 2010 with 4 replies and 580 views.

  1. Sean_J

    Sean_J Enthusiast

    Messages:
    363
    Ratings:
    17
    Java Project Ap Computer Science

    Hey guys i just need some help over the next few months with some project help here is one of my assignments and i was hoping for some help with the spicif code to get the desired output. Here is the assignment.

    Project Mixed Results
    Create a new project called MixedResults with a class called Tester. Within the main method of Tester you will eventually printout the result of the following problems. However, you should first calculate by hand what you expect the answers to be. For example, in the parenthesis of the first problem, you should realize that strictly integer arithmetic is taking place that results in a value of 0 for the parenthesis.
    double d1 = 37.9; //Initialize these variables at the top of your program
    double d2 = 1004.128;
    int i1 = 12;
    int i2 = 18;
    Problem 1: 57.2 * (i1 / i2) +1
    Problem 2: 57.2 * ( (double)i1 / i2 ) + 1
    Problem 3: 15 i1 * ( d1 * 3) + 4
    Problem 4: 15 i1 * (int)( d1 * 3) + 4
    Problem 5: 15 i1 * ( (int)d1 * 3) + 4


    Your printout should look like the following:
    Problem 1: 1.0
    Problem 2: 39.13333333333333
    Problem 3: -1345.39999999999
    Problem 4: -1337
    Problem 5: -1313
     
  2. Amurka

    Amurka Getting There

    Messages:
    1,630
    Ratings:
    343
    Re: Java Project Ap Computer Science

    What do you need help with? Everything you need is right there. Make a new class call it Tester, inside the main method in that class copy those variables, then do the math with those variables for each problem, then print out each answer. It shouldn't take you more than 2 minutes.
     
  3. OP
    Sean_J

    Sean_J Enthusiast

    Messages:
    363
    Ratings:
    17
    Re: Java Project Ap Computer Science

    I know its supposed to be simple i just don't know the code to do it. because of this i am completely lost. All i know how to do is make the skeleton.
     
  4. Amurka

    Amurka Getting There

    Messages:
    1,630
    Ratings:
    343
    Re: Java Project Ap Computer Science

    Your teacher didn't do the hello world thing or anything? That would show you printing and the main method. This is so simple you should honestly try it (look in your textbook and stuff if you need to) and then if you still need help I'll write the code. You need to do it yourself or you won't learn it and then won't be able to do real projects.

    Although if its due in like 10 minutes in your next class I'll do it now lol
     
  5. OP
    Sean_J

    Sean_J Enthusiast

    Messages:
    363
    Ratings:
    17
    Re: Java Project Ap Computer Science

    I got it done and correctly, my book didnt have the hello world thing so i looked it up aand that helped alot. Thanks