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 3 of 3

Thread: HOW TO DO????

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Thanked 0 Times in 0 Posts

    Default HOW TO DO????

    2. Check the Vehicle!

    Assume that vehicles are going through a two-way traffic intersection. There are three types of vehicles: car, motor bikes and trucks. Generate a series of 10 random integers, between 1 and 3, inclusive. The numbers represent the type of vehicle as stated below:

    Number Vehicle Category
    1 Car
    2 Motor bikes
    3 Trucks

    Write a program, using a for loop, to count how many vehicles going through the traffic intersection are cars, motor bikes and trucks. Then, the program should print out the numbers for each vehicle category. There is no user input for this program.

  2. #2
    Senior Member Ada Lovelace's Avatar
    Join Date
    May 2014
    South England UK
    My Mood
    Thanked 72 Times in 66 Posts

    Default Re: HOW TO DO????

    1. Please do not post multiple threads about problems in quick succession - focus on one problem at a time..

    2. Welcome to the forum

    3. Have you tried solving the problem yourself? Post any code that you have written and any errors you are getting - people can help you more.

    Wishes Ada xx
    Last edited by Ada Lovelace; August 2nd, 2014 at 04:18 AM.
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    Augusta Ada Byron, Lady Lovelace (1851)

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 894 Times in 877 Posts

    Default Re: HOW TO DO????

    Thread closed as homework dump with no effort.