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: JAVA PROGRAMMING HOMEWORK HELP!

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

    Default JAVA PROGRAMMING HOMEWORK HELP!

    I'm a meteorology major in a csc 212 class, and I have absolutely no clue how to attack these vague directions. anyone help me build this program pleaseeeee!



    Instructions

    Write a Java program that reads in a file containing data about cars and builds a car database. The input file can be found here. Each line of file input should be used to create a Car object. Use an array of Car objects in the CarDatabase class to access and print various information about the cars. Finally, your program should also use a command interpreter in the Main class that allows the user to issue commands and retrieve the data as shown in the example (see below).

    Design

    Make sure that your program uses a Java package called ‘csc212hw4’. Your program should consist of the following classes.

    Main -

    Read input from the user to get size of the array, input file name, and commands.

    Process commands as shown in the example.


    CarDatabase

    This should contain a private array of Car objects

    Write a constructor that accepts an integer to set the size of the array.

    Write the following public methods

    isFull() - returns a boolean value indicating if array is full.

    readFile() - accepts a string parameter (the file name) and uses a scanner to read in all the lines, create Car objects, and put them in the array.

    displayMake() - accepts a string parameter and prints all cars with that make.

    mpgRange() - accepts two double parameters and prints all the cars who's mpg falls in that range.

    weightRange() - like mpg, but for weight.

    displayAll() - display all the cars in the database.

    Car

    Should have the following public variables

    String model

    String make

    double mpg

    int weight

    int year

    A constructor method that accepts parameters to initialize all the variables

    A toString() method that returns all the variables with a label (as shown in the example)


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: JAVA PROGRAMMING HOMEWORK HELP!

    What have you tried?

Similar Threads

  1. Java Programming Homework Help!!
    By sonicsoccer in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 20th, 2013, 02:57 AM
  2. Polymorphism Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 20th, 2013, 02:21 PM
  3. Linked Lists Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 20th, 2013, 02:19 PM
  4. Replies: 8
    Last Post: February 12th, 2013, 05:45 AM
  5. android programming vs game programming using java
    By vgoel38 in forum Android Development
    Replies: 4
    Last Post: September 8th, 2012, 05:48 PM

Tags for this Thread