jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes Car Inventory Problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Car Inventory Problems" Watch "Car Inventory Problems" New topic
Author

Car Inventory Problems

Kevin Quarles
Greenhorn

Joined: Sep 07, 2009
Posts: 26
Hello,

First, I will apologize for the length of this. I have an assignment for a Inventory Program which I have a couple of errors that are causing me to lose sleep. I have been pulling an all-nighter on this, and I just can not seem to figure this one out.

The assignment overview:

Modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the output should display the value of the entire inventory.
Create a method to calculate the value of the entire inventory.
Create another method to sort the array items by the name of the product.

Here are the codes

Inventory2:


Here is the Car class:


Here are the errors I receive:

.\Car.java:89: cannot find symbol
symbol : variable Car
location: class Car
return (totalValue += Car[CarCount].getValue());
^
.\Car.java:89: inconvertible types
found : <nulltype>
required: float
return (totalValue += Car[CarCount].getValue());

Do I need to rewrite the whole program?
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

You don't need to rewrite the whole program...

Your syntax is a little off here....





Hope that helps!
Janeice

[EDIT] fixed a couple errors.... I misunderstood what you were trying to return....


When you do things right, people won't be sure you've done anything at all.
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Kevin:

Just a couple of style issues: variable names should begin with a lowercase, so:

instead of:

You probably should eliminate lines 14-18, since line 35 will blow away that object.

John.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Car Inventory Problems
 
Similar Threads
Exception in Thread-Inventory Program
Need help with Car Inventory Program part 3
My loop isn't working
Currency Problem + General Advice
Why is my type unexpected? required variable found value