tray2475's Profile
Reputation: 0
Apprentice
- Group:
- Active Members
- Active Posts:
- 70 (0.13 per day)
- Joined:
- 11-January 12
- Profile Views:
- 178
- Last Active:
Mar 22 2012 07:01 PM- Currently:
- Offline
Previous Fields
- Country:
- US
- OS Preference:
- Windows
- Favorite Browser:
- Chrome
- Favorite Processor:
- AMD
- Favorite Gaming Platform:
- XBox
- Your Car:
- Dodge
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Trouble displaying subclass arguments in GUI
Posted 18 Mar 2012
-
In Topic: Trouble displaying subclass arguments in GUI
Posted 18 Mar 2012
Thanks Guys! It works great! Until next time, Happy Coding! -
In Topic: Trouble displaying subclass arguments in GUI
Posted 18 Mar 2012
pbl, on 18 March 2012 - 12:51 PM, said:Have you noticed ?
if(selected instanceof Monitor3D) { Monitor3d d3 = (Monitor3D) selected; txt.append("\nRestocking Fee: $ " + d3.getSelectedFee()); // or whatever the function name is txt.append("\nRestocking Fee: $"); txt.append("\nTotal value With Restocking Fees: $" + "\n\n"); }
Yes Thank you! I have been starring at it for three days now and just didn't see it. -
In Topic: Trouble displaying subclass arguments in GUI
Posted 18 Mar 2012
GregBrannon, on 18 March 2012 - 12:45 PM, said:Try:
if(inv.get(currentDisplay) instanceof Monitor3D) { Monitor3D monitor3D = (Monitor3D)( inv.get( currentDisplay ) ); txt.append("\nRestocking Fee: $" + ( monitor3D.getSerial() ) );
You don't have a getter for the restocking fee, so you'll have to write one of those in your Monitor3D class and then do as above to display that.
I see! That makes sense! -
In Topic: Trouble displaying subclass arguments in GUI
Posted 18 Mar 2012
pbl, on 18 March 2012 - 12:01 PM, said:// view software public void displayMonitor() { txt.setText("\nItem Number: " + inv.get(currentDisplay).getItem() ); txt.append("\nMonitor Name: " + inv.get(currentDisplay).getName() ); txt.append("\nSerial Number"); txt.append("\nNumber In Stock: " + inv.get(currentDisplay).getUnits() ); txt.append("\nUnit Price: $" + String.format("%.2f",inv.get(currentDisplay).getPrice()) ); txt.append("\nTotal value in stock: $" + String.format("%.2f",inv.get(currentDisplay).value()) + "\n\n" ); if(inv.get(currentDisplay) instanceof Monitor3D) { txt.append("\nRestocking Fee: $"); txt.append("\nTotal value With Restocking Fees: $" + "\n\n"); } txt.append("Total value Of Full Monitor Inventory: $" + String.format("%.2f",inv.value())); }
And not a good idea to call inv.get(currentDisplay) more than once. Do:
Monitor selected = inv.get(currentDisplay);
selected.getName();
selected.getValue();
....
OK the insatnceof worked but I cant figure out the syntax to call the serial, restock fee, and restock value methods to display it in the GUI.
That should be instanceof!
My Information
- Member Title:
- D.I.C Head
- Age:
- 38 years old
- Birthday:
- April 24, 1975
- Gender:
-
- Location:
- Tampa Florida
- Interests:
- Sports, Family, Technology
- Full Name:
- Anthony Hart
- Years Programming:
- 1
- Programming Languages:
- Java, C++
Contact Information
- E-mail:
- Click here to e-mail me
- Yahoo:
-
tray2475@yahoo.com
- Facebook:
- https://www.facebook.com/tray2475
|
|


Find Topics
Find Posts
View Reputation Given

|
Comments
tray2475 has no profile comments yet. Why not say hello?