CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 1999
    Location
    Ottawa, Ontario, Canada
    Posts
    7

    I need some help Pleaeseee?

    I came across a problem where I have to implement a takeTestDrive method that takes two parameters:vehicle of type Car and miles of type int. The former is the Car object being test-driven and the later is the number of miles driven. The method adds the miles indicated to the mileage instance field or variable of the Car object. (I have a Car class created already)

    I have followed the text guide and attemped the following...

    public vehicle takeTestDrive(vehicle car)
    {
    return(car);
    }

    public int takeTestDrive(int mileage)
    {
    return(mileage);
    }

    ...But then when I compile it...this comes up...

    C:\>javac Customer1.java
    Customer1.java:62: Class vehicle not found.
    public vehicle takeTestDrive(vehicle car)
    ^
    1 error

    ...am I missing something here...your help is very much appreciated...


  2. #2
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: I need some help Pleaeseee?

    It is a bit confusing. From the description, i assume that u have created a class called 'Car'. It has all these methods.

    Now I didn't understand what is 'vehicle'. It is not a std. datatype, so it has to be a class. That's why compiler is giving error that 'vehicle' class not found.

    I think, here 'car' is a variable which can hold objects of class 'vehicle'. Do u want the same thing? If yes, u need to have 'vehicle' class.

    - UnicMan
    http://members.tripod.com/unicman

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured