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.


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

Results 1 to 2 of 2

Thread: Programming exercises

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

    Default Programming exercises

    Can anybody help me with this exercise :
    Write an application that displays the distances one can travel on a full tank of gasoline at different velocities. Use this formula to calculate distance travelled for a positive velocity, v:
    distance = (40 + 0.05v - (0.06v)2) * capacity
    where capacity is the size of the automobile's fuel tank. (Note: This simplistic formula assumes that the car has a one-gear transmission.)
    The input to the application is the fuel tank's size; the output are the distances travelled (and the time taken to do so) for velocities 20, 40, 60, 80, and 100 miles per hour. Display the answers graphically, so that the answers are pictures like this:

    For a 10-gallon fuel tank:
    /A CAR\
    40 m.p.h.: =================== -o--o-- 362.4 miles in 9.06 hours

    /A CAR\
    60 m.p.h.: =============== -o--o-- 300.4 miles in 5.007 hours

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 688 Times in 675 Posts

    Default Re: Programming exercises

    You'll have to show us some effort. Post what you've tried with any questions, errors, or problems you're having, and we can help you with those. We can't do the exercise for you.

Similar Threads

  1. Arrays exercises and tasks
    By 1click in forum Java Code Snippets and Tutorials
    Replies: 3
    Last Post: October 20th, 2013, 05:29 PM
  2. Replies: 1
    Last Post: March 21st, 2013, 06:57 AM
  3. Inheritance & Hierarchy Exercises?
    By Beacon in forum Object Oriented Programming
    Replies: 2
    Last Post: September 21st, 2012, 11:34 AM
  4. Replies: 0
    Last Post: December 12th, 2011, 02:17 PM
    By Maximillian in forum Java Theory & Questions
    Replies: 5
    Last Post: November 17th, 2009, 04:55 PM