tray2475's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
70 (0.13 per day)
Joined:
11-January 12
Profile Views:
178
Last Active:
User is offline 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
Icon   tray2475 has not set their status

Posts I've Made

  1. In Topic: Trouble displaying subclass arguments in GUI

    Posted 18 Mar 2012

    View Postpbl, on 18 March 2012 - 01:48 PM, said:

    View Posttray2475, on 18 March 2012 - 03:53 PM, said:

    Yes Thank you! I have been starring at it for three days now and just didn't see it.

    I doubt, I have posted it a two hours ago :)


    LOL I meant the issue you were pointing out! :surrender:
  2. In Topic: Trouble displaying subclass arguments in GUI

    Posted 18 Mar 2012

    Thanks Guys! It works great! Until next time, Happy Coding!
  3. In Topic: Trouble displaying subclass arguments in GUI

    Posted 18 Mar 2012

    View Postpbl, 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.
  4. In Topic: Trouble displaying subclass arguments in GUI

    Posted 18 Mar 2012

    View PostGregBrannon, 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!
  5. In Topic: Trouble displaying subclass arguments in GUI

    Posted 18 Mar 2012

    View Postpbl, 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! :bigsmile:

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:
Yahoo  tray2475@yahoo.com
Facebook:
https://www.facebook.com/tray2475

Friends

Comments

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