• Post Reply Bookmark Topic Watch Topic
  • New Topic

Inventory 3 to 4 GUI- Java  RSS feed

 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everyone has been so helpful in helping me get through these series of assignments. I am now on my week 7 assignment and I'm using my assignment from last week to modify into a GUI. I am having difficulty trying to get some of my modifications fixed. To top it off, I basically had to start all over because I accidentally highlighted some code and delete it earlier. Didn't realize it until it save. However, I got much of it fixed up but a couple of issues that maybe you guys could help with.

Assignment:
Modify the Inventory Program to use a GUI. The GUI 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 GUI should
display the value of the entire inventory, the additional attribute, and the
restocking fee.


What I have for InventoryDVD:


What I have for Clas Product:


What it looks like:
[Lofelia_gui_inventory_4.DVD;@3125fe1
[Lofelia_gui_inventory_4.DVD;@3125fe1
[Lofelia_gui_inventory_4.DVD;@3125fe1
[Lofelia_gui_inventory_4.DVD;@3125fe1
[Lofelia_gui_inventory_4.BlurayDVD;@4482acef
[Lofelia_gui_inventory_4.BlurayDVD;@4482acef
Welcome to the Inventory Program.
Product Title: Independence Day
The number of units in stock is 6
The price of each DVD is: $5.23
The item number is: 1
The value of the title is: $31.380000000000003

Welcome to the Inventory Program.
Product Title: Armeggedon
The number of units in stock is 8
The price of each DVD is: $4.73
The item number is: 2
The value of the title is: $37.84

Welcome to the Inventory Program.
Product Title: Fast and Furious
The number of units in stock is 3
The price of each DVD is: $6.01
The item number is: 3
The value of the title is: $18.03

Welcome to the Inventory Program.
Product Title: The Notebook
The number of units in stock is 4
The price of each DVD is: $3.15
The item number is: 4
The value of the title is: $12.6

Product Title: Ride Along.
The number of units in stock is: 3.
The price of each DVD is: $6.58.
The item number is: 5.
The value of the title is: $19.740000000000002.
This is a BluRay DVD.
The restock fee for this title is: $0.0

Product Title: Live Free Die Hard.
The number of units in stock is: 4.
The price of each DVD is: $7.81.
The item number is: 6.
The value of the title is: $31.24.
This is a BluRay DVD.
The restock fee for this title is: $0.0

The value of the entire inventory is: $50.980000000000004
[Armeggedon, Fast and Furious, Independence Day, Live Free Die Hard, Ride Along, The Notebook]
To leave this program, type 'Exit'.



I'm not having any errors on the "class products" that are compiling or warnings?


1. I can't figure out why my restocking fee is compiling 0.0 value.

2. I don't understand why or how to fix the class, subclass, or main methods, and I've been trying for about 5 hours now.

3. Also, My Instructor wants the lines on the GUI to be one product at a time... what I have so far should work right? I've been at this for too long, I'm tired, but I gotta get through this class to graduate.

4. InventoryDVD has error:

I am having an error on Inventory DVD line 206.
illegal start of expression
cannot assign a value to final variable COLOR
incompatible types: String cannot be converted to Color Type
";" expected
not a statement
";" expected
cannot assign a value to final variables SIZE
incompatible types: String cannot be converted to int
"int"
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm so sorry it's so long, I just wanted to make sure no one is confused and unaware of the errors. thank you all kindly.

Also the value of the titles are not looking or acting right?
 
Scott Winterbourne
Ranch Hand
Posts: 116
2
Eclipse IDE Java PHP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the tags around your code here on line 206?


Seems to me you should remove these extra tags and just have
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, I modified it and got rid of it. Now I have no errors, but the restocking value is not coming up and either is the entire inventory value. It looks like this.
debug:
[Lofelia_gui_inventory_4.DVD;@189ddde9
[Lofelia_gui_inventory_4.DVD;@189ddde9
[Lofelia_gui_inventory_4.DVD;@189ddde9
[Lofelia_gui_inventory_4.DVD;@189ddde9
[Lofelia_gui_inventory_4.BlurayDVD;@3125fe1
[Lofelia_gui_inventory_4.BlurayDVD;@3125fe1
Welcome to the Inventory Program.
Product Title: Independence Day
Number of units in stock is 6
Price of each DVD is: $5.23
Item number is: 1
Value of the title is: $31.380000000000003

Welcome to the Inventory Program.
Product Title: Armeggedon
Number of units in stock is 8
Price of each DVD is: $4.73
Item number is: 2
Value of the title is: $37.84

Welcome to the Inventory Program.
Product Title: Fast and Furious
Number of units in stock is 3
Price of each DVD is: $6.01
Item number is: 3
Value of the title is: $18.03

Welcome to the Inventory Program.
Product Title: The Notebook
Number of units in stock is 4
Price of each DVD is: $3.15
Item number is: 4
Value of the title is: $12.6

Product Title: Ride Along.
Number of units in stock is: 3.
Price of each DVD is: $6.58.
Item number is: 5.
Value of the title is: $19.740000000000002.
This is a BluRay DVD.
Exception in thread "main" java.lang.UnsupportedOperationException: Not supported yet.
at ofelia_gui_inventory_4.BlurayDVD.getRestockFee(InventoryDVD.java:208)
at ofelia_gui_inventory_4.InventoryDVD.main(InventoryDVD.java:62)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to step away for a bit, this is starting to drive me nuts. Does anyone have any ideas? Anyone have an idea on what would be easy, but still make it pop in GUI? Suggestions and Ideas are always helpful! :-)
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stop. You have an app which does not work; you cannot therefore put a GUI on top of it.
 
Scott Winterbourne
Ranch Hand
Posts: 116
2
Eclipse IDE Java PHP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Stop. You have an app which does not work; you cannot therefore put a GUI on top of it.


Absolutely agree with Campbell. You really want to make sure the logic is correct and the code is clean before attempting to create a GUI for this.

You should tackle the issue of the inventory total not being output first. Once you fix the error, go back over your code to make sure it's doing exactly what you need. Not outputting stuff you don't need and is including everything you do need in the proper format.

Then make sure your code is commented and documented so you can easily understand what each part of it is doing and others can as well.

Then you can start figuring out the GUI part.
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I'm not trying to do a GUI yet. I'm trying to get this done first. I'm still having problems with it. I am waiting to see what my teacher says about it because I still can't get it working right.
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I'm think I see something but don't know how to do it. In my BlurayDVD class I call super, and I'm not understand why but I think there is something wrong here... my teacher said it has something to do with the super I called and that the BlurayDVD class does not extend (subclass) the DVD class... How do I fix it?
 
Scott Winterbourne
Ranch Hand
Posts: 116
2
Eclipse IDE Java PHP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like it's throwing the exception when it tries to call the getRestockFee() method.

Can you post the updated version of the setRestockFee() and getRestockFee() methods from lines 205 thorugh 213 in your posted code above? There may be a syntax error or something in the updated code.
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, there section you refer to is this: (I'm getting an error now for line 22 "constructor Object in class object cannot be applied to given types. Required: no arguments. Found Sting, int, double, int. Reason: actual and formal argument lists differ in length." I don't get this error.

 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the other two:






They show no errors, but when I click on any line in class DVD from lines 23 down, it gives a warning "missing javadoc." How do I give it the right javadoc. Do I rename the public class DVD on line 13?
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what's going on, now it won't compile at all.
 
Os Stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to say thank you to all of you. I solved what I needed. Now I will be working on my GUI. I can't even begin to express my gratitude. Thank you all. Big thank you to Swastik Dey! @SwastikDey .
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!