Results 1 to 2 of 2
  1. #1
    danakabeaver is offline Member
    Join Date
    Apr 2012
    Rep Power

    Default Need help with this assignment

    Here is my assignment:

    To manage a parking lot
    You are a manager of a parking lot and decide to keep track all the cars parked in your lot. You want to
    know the maker, model, color, and license plate of the cars. Since you learned about ArrayList and you
    like to use an ArrayList to keep track of cars entered the lot. Each time a car left the lot, the remove
    method of ArrayList class can be used. Each time a car entered, add method can be used. To keep track
    how many cars in the lot, the size method can be used.
    But before you write your application to create a class called MyParkingLot, you have to write a class
    call Car which contains all the information you need as describe in the previous paragraph. Also develop
    constructor(s) and getters or setters as needed so that you can retrieve (get) and record (set)
    information such as maker, model, color, and license plate number.
    For MyParkingLot class, it shall consist of an ArrayList which will be used to maintain the information of
    all the cars in and out of this parking lot. It shall be able to output a menu to allow garage keeper to use.
    For example, It shall include a menu item which when selected will printout all cars in the lot; a menu
    allows car to enter the garage by record the information such as maker, model, color, and license plate
    number; a menu allows a car to exit (remove that car object from your arrayList);A menu which can
    search for a particular description of the car in the lot. For example, there may be a submenu that asks
    the user to select options of the search. For example: find all Honda cars, find all silver color cars, find a
    car with license plate number “123-abc” etc.

    I am very new to programming so i may be way of with this, but this is what i have so far:

    Car class:
    public class Car
    private String maker;
    private String model;
    private String color;
    private String lpnum;

    public Car(String mk, String md, String clr, String lpn)
    maker = mk;
    model = md;
    color = clr;
    lpnum = lpn;

    public String getmaker()
    return maker;

    public String getmodel()
    return model;

    public String getcolor()
    return color;

    public String getlpnum()
    return lpnum;

    public String toString()
    return (maker + " " + model + " " + color + " " + lpnum);

    myParkingLot class:

    import java.util.ArrayList;
    import java.util.Scanner;

    public class MyParkingLot
    public static void main(String[] args)
    ArrayList <Car> myLot;
    myLot = new ArrayList <Car> ();

    Scanner scan = new Scanner (;
    int selection;

    System.out.println ("Menu");
    System.out.println ("Please select a number");
    System.out.println ("1. Print all cars in the lot");
    System.out.println ("2. Enter a car");
    System.out.println ("3. Exit a car");
    System.out.println ("4. Search for a car");
    System.out.println ("5. Exit menu");
    selection = scan.nextInt();

    while (selection != 5)
    if (selection == 1)
    System.out.println (myLot);
    else if (selection == 2)
    System.out.println ("Enter maker, model, color, and license plate numer");
    System.out.println ("Please seperate by commas");
    Car c =;
    else if (selection == 3)
    System.out.println ("Enter maker, model, color, and license plate numer");
    System.out.println ("Please seperate by commas");
    Car c =;
    else if (selection == 4)

    I am now stuck, so any help would be awsome

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Need help with this assignment

    Please edit your code and properly indent it and add code tags so it can be read and understood. Code statements should not all start in the first column.

    Pick the next requirement to work, figure out what the code needs to do to accomplish it and try coding it, compiling and testing it. If you have problems with getting it to work, post a description of what you are trying to do and the code you are trying to make do it.
    If there are errors, post the full text of the errors with your questions.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Help With Assignment
    By EpyonCustom in forum New To Java
    Replies: 10
    Last Post: 04-03-2011, 07:04 AM
  2. HW assignment help
    By mackavelirip in forum New To Java
    Replies: 5
    Last Post: 03-31-2011, 04:34 AM
  3. assignment help
    By xyknight in forum New To Java
    Replies: 6
    Last Post: 03-13-2011, 08:19 PM
  4. assignment
    By mr.othman in forum New To Java
    Replies: 4
    Last Post: 12-03-2010, 03:55 PM
  5. need help! assignment due by tmr!
    By keycoffee in forum New To Java
    Replies: 3
    Last Post: 02-10-2010, 06:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts