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: Assignment

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Assignment

    In this assignment, you will create a program that computes the distance an object will fall in Earth's gravity.

    Create a new class called GravityCalculator.
    Copy and paste the following initial version:

    class GravityCalculator {
    public static void main(String[] arguments){
    double gravity =-9.81; // Earth's gravity in m/s^2
    double initialVelocity = 0.0;
    double fallingTime = 10.0;
    double initialPosition = 0.0;
    double finalPosition = 0.0;
    System.out.println("The object's position after " + fallingTime +" seconds is "+finalPosition + " m.");
    }
    }

    Run it
    Modify the example program to compute the position of an object after falling for 10 seconds, outputting the position in meters. The formula in Math notation is:

    x(t) = 0.5at2 + vit + xi

    Variable
    Meaning
    Value
    a
    Acceleration (m/s2) -9.81
    t
    Time (s)
    10
    vi
    Initial velocity (m/s) 0
    xi
    Initial position 0

    Note: The correct value is -490.5 m. Java will output more digits after the decimal place, but that is unimportant.

    Submit your GravityCalculator.java file along with the output you received when running it. The output should be captured as a screen capture or by cutting and pasting the output from the window that the output of your program is displayed in.


  2. #2
    Member
    Join Date
    Apr 2012
    Location
    Superior, CO, USA
    Posts
    80
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default Re: Assignment

    Do you have a question or do you just want to drop the class now?
    Need Java help? Check out the HotJoe Java Help forums!

Similar Threads

  1. Need help with Tic Tac Toe assignment
    By BAL1990 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 28th, 2011, 01:33 PM
  2. assignment troubles polymorphism (guide for assignment included)
    By tdawg422 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 8th, 2011, 10:01 AM
  3. Help with assignment
    By NPVinny in forum What's Wrong With My Code?
    Replies: 12
    Last Post: July 3rd, 2010, 05:31 PM
  4. Replies: 1
    Last Post: February 22nd, 2010, 08:20 AM
  5. Need help with assignment
    By TonyL in forum Loops & Control Statements
    Replies: 2
    Last Post: February 20th, 2010, 09:44 PM