I was able to get what I posted earlier to work with some tweaking. I did make a few mistakes like I didn't know how to add the calculation for the 5% so I manually added it in the array. The printout looked right, but the program had more than I needed I guess. Not a big deal as it only cost me a few points.
Now, on to the fun stuff - GUI! I haven't a clue where to start so it might be a day or so until I get something posted on...
User Profile
Collapse
-
Ahh, I did it again! I just answered my own question. If I declare the InvTest as public and save it as InvTest.java it works. OK, let me analyze and apply it to the program I'm working on.
But can anyone answer why it can't be Inventory.java if the Inventory class is declared as public?Leave a comment:
-
Here is some code I'm trying to understand:
Code://Inventory3 // the DVD Class class DVD extends Inventory { String genre; // Genre of the DVD double restockingFee; // percentage that is added to the base price as a restocking fee //( actual inventory value will be the base inventory value plus // the base inventory value times this amount
Leave a comment:
-
Thanks r035198x! That makes a lot more sense now and I see what I did wrong with the sort. Now I have to modify the program again.
CheckPoint: Inventory Program Part 3
Resources Required
Chapters 9 & 10 in Java: How to Program
• Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose (for the DVDs subclass,...Leave a comment:
-
A little bit. The code from earlier in this post was a good example. I am stuck though as to why I can't my current code to compile.Leave a comment:
-
Ahh, Sorry! I forgot to post the code.
Here it is:
Code://Inventory2.java import java.util.*; class Product implements Comparable { private String name; // class variable that stores the item name private long number; // class variable that stores the item number private long stockQuantity; // class variable that stores the quantity in stock
Leave a comment:
-
OK, so I went through and I think I got the sort figured in, but now I can't compile my program. The error I get is:
C:\Inventory2.j ava:112: illegal start of expression
public void sortByName() {
^
1 error
Tool completed with exit code 1
Why can't I start my expression like that? In the Churches program you did and that compiles fine. What am I missing?Leave a comment:
-
I am using 1.5 and I just realized what I did wrong (duh). I saved the file as Church.java instead of Churches.java. It still compiled, but I got a run error when it ran. Churches run fine and I see how you are sorting it. I will try to apply this to my program and will post on here if I can't get it.
I'm sure I'll have more question with the later assignments so I will post on here in the future if that's OK. Or I can create a new...Leave a comment:
-
That doesn't really help me much! I'm not sure I understand the example though and the code doesn't compile so I can't see how the program works. I'm also not sure why my original sort doesn't work. What's wrong with the code?Leave a comment:
-
Yes, the array.sort does work fine, but for some reason we are not allowed to use that method to sort.
I get a bunch of errors when I insert your code. Here's what I get:
C:\Inventory2.j ava:142: cannot find symbol
symbol : variable swapped
location: class Inventory2
swapped = false;
^
C:\Inventory2.j ava:145: cannot find symbol
symbol : variable swapped
location: class...Leave a comment:
-
OK, I'm making some progress. I still need to sort without using array.sort. I tried a bubble sort which I kept in there, but it wouldn't work for me. And I would still like to know how to allign the names better.
Here is what I just came up with:
Code://Inventory2.java import java.util.*; class Product implements Comparable { private String name; // class variable
Leave a comment:
-
OK, I've been playing around with some of the code and I'm making progress. Here's what I have now. I would like to display the total amount at the bottom instead of the top and display the list as is then display as sorted. I also can't use the array.sort so I need to sort another way.
I would also like to display the DVD's in a uniform line rather than 1 space after the field:. For example:
DVD Name:___DVD1
Item:________1...Leave a comment:
-
Thanks, I just read the code tags rule to the right! Shows you how observant I am!...Leave a comment:
-
Yes, I read through that whole post and it did not help much as it's somewhat jumbled. That is the same project I'm working on though. Their part3 is close to what I need, but not quite there.
Can you please explain code tags?...Leave a comment:
-
Need help with Class Project!
OK, so I'm very new to Java programming and I've been able to squeek by so far, but I'm completely stuck on this assignment. Here is the assignment that is due this week -
• 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...
No activity results to display
Show More
Leave a comment: