Jordan Richt

Greenhorn
+ Follow
since Apr 23, 2016
Jordan likes ...
Firefox Browser C++ Linux
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jordan Richt

Sorry for the late reply. Thank you for your insight. So I thought about it and decided tool shouldn't be abstract and here is my new code(if its not shown I didn't change it.)

Vehicle Class



Product Class



Car Class



Truck Class



Tool Class


InventoryDemo Class



I fixed the capitalization and the Product/obj issue. None of my code is throwing errors anymore either. But now I am working on the class that tests the code called InventoryTester. I completed step six(rest of instructions are below, see first post for the first half) and the code runs successfully and prints out the name a colon and then the price. I also got 6c working. But part b in six is where I am having issues.

I guess I have to loop through the array and find each item that has the name I am looking for, and then using the index of that item calculate quantity and total cost? In a simple array I would know what to do but since its an array of instances I don't know how to access the specific data. And if for example I was passed Jigsaw and there were two jigsaw items I would have to look for both of them somehow so I could know the quantity?
5 years ago
Hello everyone! My first post I am working on an assignment for an on-line AP Computer Science Course. The instructions are attached. Basically I am putting a lot of what I learned together.

Here is my code so far:

Vehicle Class


Product Class



Car Class



Truck Class



Now I am hung up on the instructions to "Create class Tool that implements Product and Comparable<T>. "

Here is what I have for the tool Class so far:



Should it be an abstract class? Do I need to restate the variable names and reference in the constructor? Right now it gives the error: "Cannot find symbol-Variable cost" when I try to compile the tool class. Could anyone help me a little? Thank you for your time!
5 years ago