Object Oriented Blackjack game for class final...

I'm trying to accomplish my final & this is what I have so far. The teacher has given permission to use outside resources, so I'm hoping you can help.
This is what I have so far.....any suggestions?
Thank you
//Play one hand of Blackjack
import java.util.Random;//program uses class Random
public class Blackjack
     private String dealer;//Dealer who does not play
     private int player1;//Player one of three
     private int player2;//Player two of three
     private int player3;//Player three of three
     Random randomNumbers = new Random();//Random number genertor
          //enumeration with constants that represent game status
          private enum Status{ HIT, STAND, WIN, LOST }
          public void Blackjack( String Alice, int Emily, int Matt, int Mary )
               //initializing variables in declaration
               Alice = dealer;
               Emily = player1;
               Matt = player2;
               Mary = player3;
               int nextCard;
               int totalHand;
               Status gameStatus;
               int sumOfCards = dealCard();
               int Blackjack = 21;
               int hit;
          public int dealCard()//deal cards, calculate sum and display results
               //Player1 is dealt 2 cards
               int card1 = 1 + randomNumbers.nextInt( 10 );
               int card2 = 1 + randomNumbers.nextInt( 10 );
               int sum = card1 + card2;
               System.out.printf( "Emily is dealt %d, %d\nHer hand is: %d\n",
               card1, card2, sum );
               //Player2 is dealt 2 cards
               card1 = 1 + randomNumbers.nextInt( 10 );
               card2 = 1 + randomNumbers.nextInt( 10 );
               sum = card1 + card2;
               System.out.printf( "Matt is dealt %d, %d\nHis hand is: %d\n",
               card1, card2, sum );
               //Player3 is dealt 2 cards
               card1 = 1 + randomNumbers.nextInt( 10 );
               card2 = 1 + randomNumbers.nextInt( 10 );
               sum = card1 + card2;
               System.out.printf( "Mary is dealt %d, %d\nHer hand is: %d\n",
               card1, card2, sum );
               return totalHand;//return sum of hand
               //Report game status and maintain sum of hand
               switch ( sum of cards )
                    //Dealer asks player if he/she wants another card
                    System.out.println( "Do you want a hit?" );
               if ( gameStatus == Status.HIT )
                    nextCard = 1 + randomNumbers.nextInt( 10 );
                    totalHand = nextCard + sum;
                    System.out.printf("Emily's next card is %d\nEmily's hand is: %d\n",      
                    nextCard, totalHand );
}

The following is not a constructor:
public void Blackjack( String Alice, int Emily, int Matt, int Mary )
   //initializing variables in declaration
  Alice = dealer;
  Emily = player1;
  Matt = player2;
  Mary = player3;
}Remove the word "void" to make it a constructor
public Blackjack( String Alice, int Emily, int Matt, int Mary )And, your code doesn't make sense. When you make that into a constructor and run the constructor, you will do something like this:
Blackjack game = new Blackjack("Alice", 1, 2, 3);But, when you run the constructor, dealer is 'null' [default value of String variable]; and player1, player2, and player3 are 0 [default value of int variable]. Your constructor essentially says:
Alice = null;
Emily = 0;
Matt = 0;
Mary = 0;It sets the parameters to new values, but only locally within the constructor. The instance variables don't get new values at all. You need to reverse the assignments:
dealer = Alice;
player1 = Emily;
...It doesn't make a lot of sense to name your parameters to the constructor with specific persons' names. Not sure what your int values for players are for, anyway. You should have a Player class, as someone else suggested. It should have a name that can be set by the person running your program. Your game could start by saying:
What is the name of Player 1?
What is the name of Player 2?
What is the name of Player 3?Then use the names to generate messages in the program.

Similar Messages

  • Open source, object-oriented embedded database for J2ME

    For J2ME-based devices that require embedded data management, there is now an open source, object-oriented embedded database for J2ME called Perst Lite.
    Perst Lite can be downloaded as part of the Perst open source embedded database package, at
    http://www.mcobject.com/downloads.php?step=2&catID=4
    Cheers,
    Ted

    Spam blocked. As this user has only ever logged in here to post spam, the user account is blocked for a year.
    db

  • Object Oriented AS3 game programming - where do I start?

    I’m a programmer familiar with object oriented
    programming, with experience in C++, C# and the MS Visual Studio
    development environment.
    I’ve been tasked to create a web based game using Flash
    CS4 and ActionScript3. I am new to Flash, ActionScript and game
    programming. I have never used previous versions of Flash or
    ActionScript.
    The game will be a single player role playing game. The
    player will have the ability to create an avatar.
    The player will move the avatar from screen to screen based
    on button clicks or drag and drop onto objects in the current
    screen.
    Players must register, and player information will be stored
    in a database backend. Additonal data will be saved to the backend
    database during game play.
    The saved data will be based on player actions in various
    screens, and in some cases data entered in a form on a screen.
    For a first pass a stick figure avatar and screens containing
    simple buttons and simple objects to drag the avatar to will be
    sufficient. I would like to store data in a database tracking
    date/time information, e.g. date/time each screen is
    entered/exited.
    Any links to articles, or better yet, sample code showing
    these concepts would be greatly appreciated – Thanks

    Start is relative term. It took me too long just to find out
    how to "hello the world" so I'll save you that work.
    In Flash (Note: I'm using CS3 but I doubt this part of the
    menu has changed that much)
    1) File -> New -> ActionScript File
    2) Paste in the following:
    package junkdir {
    import flash.display.Sprite;
    public class junktest extends Sprite {
    public function junktest() {
    trace("Hello world");
    3) Save as some_folder/junkdir/junktest // obviously create
    new folder 'junkdir' during this process
    4) File -> New -> Flash File (Action Script 3.0)
    5) In the properties field labeled 'document class' type in
    junkdir.junktest // THIS WAS THE OBSCURE PART
    If the properties field did not automatically open then
    manually open with: Window -> Properties -> Properties
    6) Save this file as 'junk' in some_folder
    7) Control -> Test Movie
    "Hello World" appears in the Output Window. (This also can be
    opened manually)
    Read whatever Adobe online docs gets you involved quickly, I
    like the display objects just for a quick visual high. Most code
    will cut and paste into this 'junk' framework.
    I recommend two O'Reilly books: Actions Script 3.0 Quick
    Reference Guide by Stiller, Shupe, deHaan & Richardson and
    Essential ActionScript 3.0 by Collin Moock.
    Hope this helps. Good luck.

  • This card game for class

    i had this original program that i got to work then my teacher asked me to add in those gui stuff and now i dont know what to do
    ok here are my methods:
    // Demonstrating the JTextField class.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JFrame {
    private JTextField input,input2;
    private JLabel label1,label2;
    private JButton endButton;
    // set up GUI
    public Test()
    super( "yo" );
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    // construct textfield with default sizing
    label1 = new JLabel("How many players?");
         input = new JTextField( 10 );
         input.setToolTipText ( "How many players?" );
    container.add( label1 );
    container.add( input );
    // construct textfield with default text
    label2 = new JLabel("How many cards?");
    input2 = new JTextField( 10 );
    input2.setToolTipText( "How many cards?" );
    container.add( label2 );
    container.add( input2 );
         endButton = new JButton( "Deal" );
         ButtonHandler ButtonAction = new ButtonHandler();
         endButton.addActionListener(ButtonAction);
    container.add( endButton );
    setSize( 275, 170 );
    setVisible( true );
    public static void main( String args[] )
    Test application = new Test();
    application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    private class ButtonHandler implements ActionListener
         public void actionPerformed( ActionEvent event )
              int players=0;
              int tofinish=1;
              String player;
              player = input.getText();
              String cards;
              cards = input2.getText();
              Cards card;
              card = new Cards();
              for (;tofinish<=players;tofinish++)
              card.clearitout();
              card.deal();
    } // end class TextFieldTest
    and then here is my test program
    import javax.swing.*;
    public class TestCards{
         public static void main (String[] args) {
         Cards card;
         card = new Cards();
         card.clearitout();
         card.deal();

    here is the code for the original game that worked without the gui
    import javax.swing.*;
    import java.util.Random;
    public class Cards extends Object{
    String cards[] = new String[52];
    String cardnames[] = {"ace","two","three","four","five","six","seven","eight","nine","ten","jack","queen","king"};
    String suitnames[] = {"spades","hearts","clubs","diamonds"};
    Random rand = new Random();
    //constructor
    public Cards()
    public void clearitout () {
    for(int index=1;index<=cards.length-1;index++)
    cards[index]=("unused");
    public void deal () {
    int cardsdelt=0;
    int index;
    while(cardsdelt<=5)
    index=(rand.nextInt(52));
    if (cards[index]=="unused")
    cards[index]="used";
    System.out.println(cardnames[identifycard(index)] + " of " + suitnames[identifysuit(index)]);
    cardsdelt++;
    System.out.println("");
    private int identifysuit(int index) {
    int suit=0;
    suit = index/13;
    return suit;
    private int identifycard (int index) {
    int card=0;
    card = index%13;
    return card;

  • Object Oriented? Or Not?

    Perhaps the way I raised this question would be peculiar for you as I'm a newbie!
    I'm willing to use oracle object oriented programing for my applications, and some senior people(work in my organization) told me that Object oriented database concept is failed in the industry. As a reason they say that; even if Object oriented databases solved some problems people had with relational databases, still Object oriented databases are failed to facilitate most of the advantages of relational databases. It's somewhat chaotic for me, as I'm new to PL developments.
    They didn't mention any specific reason; but just told me that relational databases perform well and faster than object oriented databases, and for business logic, object oriented databases has some accuracy issues.
    But I'm not ready to accept that it will be useless to learn 'Oracle Object Oriented Programing' or 'Object Oriented Database Concept' would be failed.
    So I need to know,
    1. Will it be useless to learn & use 'OOP' techniques when learning PL/SQL programing?
    2. Is there any disadvantage of using 'OOP' with oracle? (If there is any, please let me know if you have time for that).
    Especially, (The most pleasing answer I would like to hear from you ;-) )
    3. If Object Oriented Databases concept is better and something that a "PL/SQL" developer must learn; please let me know that.
    Please provide me a link if you can, which would help me to learn why should we use 'OOP' with oracle (if Object oriented database is better than Relational database)

    Intruder wrote:
    So I need to know,
    1. Will it be useless to learn & use 'OOP' techniques when learning PL/SQL programing?No. OOP has very little do with relational database design. The two is not mutually exclusive and can co-exist easily.
    2. Is there any disadvantage of using 'OOP' with oracle? (If there is any, please let me know if you have time for that).That depends on how+ you use it. If OOP was truly horrible and bad, then why does Oracle spend money on the research and development on it for their RDBMS product?
    Especially, (The most pleasing answer I would like to hear from you ;-) )
    3. If Object Oriented Databases concept is better and something that a "PL/SQL" developer must learn; please let me know that.OOP is not Object Orientated Database. These are two very different concepts. OOP competes with procedural programming. Object Orientated Database design competes with Relational Database Design (and others of course).
    There are two primary issues with an Object Orientated Database design. Complexity. Performance.
    Do you for example store the subclasses of the same abstract class in the same physical object table? You can do that in Oracle.. but then the database need to resolve the class type at run-time.. every single time.. for every single object accessed... At what cost ito performance?
    How do you treat collection classes? A collection can be stored as a physical table. It can also be stored as an attribute (column) of an object (table) - in which case the physical implementation for that is a nested table. There are dire performance issues with nested tables when these are used and applied incorrectly.
    There are numerous such issues.
    Compare this with something as mature and robust as Relational Database Design. Easy to understand. Easy to use. And what the Oracle RDBMS product was specifically designed to support.
    Which one is "+better+" (especially in the Oracle RDBMS environment)? It should be obvious.
    I suggest that you read Codd's original paper on "+A Relation Model of Data for Large Shared Data Banks+", read "+The Third Manifesto+" from Chris Date, and papers from various other authors for insight.

  • Object-Oriented Programming

    I'm working on a code associated with object-oriented programming:
    The StreetAddress class has this constructor:
    StreetAddress( String street, String city,
                   String state, String zip );
    and the following methods:
    void SetStreet( String street ); and String GetStreet();
    void SetCity( String city); and String GetCity();
    void SetState( String state ); and String GetState();
    void SetZIP( String zip ); and String GetZIP();
    String MailingLabel();.
    The last of these returns the mailing address in the following form:
    street
    city, state zipand this is what i have so far:
    public class StretAddress
      private String myStreet;
      private String myCity;
      private String myState;
      private String myZip;
      public StreetAddress( String street, String city, String state, String zip)
        myStreet = street;
        myCity = city;
        myState = state;
        myZip = zip;
      public String getStreet() 
          return myStreet;
      public void SetStreet( String street )
        myStreet = street;
      public String getCity()
          return myCity;
      public void SetCity( String city )
        myCiy = city;
      public String getState()
         return myState;
      public void SetState( String state )
        myState = state;
      public String getZip()
        return myZip;
      public void SetZip( String zip )
        myZip = zip;
      public String MailingLabel()
      System.out.println(street \n city, state + " " + zip);
    }I have no idea what to do now, can someone please help me with this?

    ejp wrote:
    personally, i don't think you need all four in order to be object-oriented.Without all four it might be class-based, or object-based, but not object-oriented. See Peter Wegner's paper which defined all this in 1987:
    http://www.cse.msu.edu/~stire/cse891f04/wegner.pdf
    With all due respect, I find this "definition" more meaningful:
    http://www.youtube.com/watch?v=bfx7tvGisbA

  • Use a Shared Object in a game to store pairs player_name - player

    If I want to use a Shared Object in a game for a local
    computer to store
    pairs player_name - player_score (a string and a number) what
    would be the
    best approach to push the data in and retrieve them out as a
    table?
    Flash Help says that the properties created in a SO can
    enumerated in a
    for..in loop - how do I use this?

    thank a lot
    "clbeech" <[email protected]>
    ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ
    × ÎÏ×ÏÓÔÑÈ
    ÓÌÅÄÕÀÝÅÅ:
    news:fvsrst$qkp$[email protected]..
    > I usually use an array and objects to store the pair or
    more stats, then
    store
    > the array in the SO. it goes something like this:
    >
    >
    > var so = SharedObject.getLocal('mygame', '/');
    > var scores = [ ];
    > for(var i=0; 1<10; i++) {
    > var obj = {n:' ', s:o};
    > scores.push(obj);
    > }
    >
    > function updateScores() {
    > if(so.data.highscores == undefined) {
    > so.data.highscores = scores;
    > }else{
    > scores = so.data.highscores;
    > }
    > }
    >
    > function saveScore() {
    > var obj = {n:name_ti.text, sc:playerScore}
    > scores.push(obj);
    > scores.sortOn('s', Array.NUMERIC | Array.DESCENDING);
    > if(scores.length>10) scores.pop();
    >
    > so.data.highscores = scores;
    > so.flush();
    > setScoreboard();
    > }
    >
    > function setScoreboard() {
    > updateScores();
    > scores.sortOn('s', Array.NUMERIC | Array.DESCENDING);
    > for(var i=1; i<scores.length+1; i++) {
    > this['name_'+i].text = scores
    .n;
    > this['score_'+i].text = scores.s;
    > }
    > }
    >
    > setScoreboard(); //initialize the board
    >
    > save_btn.onPress = function() {
    > saveScore(); //save the score input
    > }
    >

  • Adding color to a row in alv grid not using object oriented.

    Hello Gurus.
    I want to display a row in  color in alv grid using normal alv,  not by using object oriented programming.
    I am having one of the field say spart ie division in internal table itab.
    The spart has values like 12 , 45, 67, 68 ,88 ,99.
    when ever spart is 12 i want to display that row in color format. Here this table is sorted by mblnr so if 1st record is 12 then may be 50 th record will be 12. so when where the record contains the value has 12 then that row should be displayed in color. So please tell me how to do it. Previously i posted the same question but i got is by using object oriented. so please tell me how to do it without using object oriented.
    Thanks for all the replies.

    Check this example code.
    report zrich_0004
           no standard page heading.
    type-pools slis.
    data: fieldcat type slis_t_fieldcat_alv.
    data: begin of imara occurs 0,
          matnr type mara-matnr,
          mtart type mara-mtart,
          maktx type makt-maktx,
          color_line(4) type c,
          tcolor type slis_t_specialcol_alv,  "cell
          end of imara.
    data: xcolor type slis_specialcol_alv.
    start-of-selection.
      perform get_data.
      perform write_report.
    *  Get_Data
    form get_data.
      imara-matnr = 'ABC'.
      imara-mtart = 'ZCFG'.
      imara-maktx = 'This is description for ABC'.
      append imara.
      imara-matnr = 'DEF'.
      imara-mtart = 'ZCFG'.
      imara-maktx = 'This is description for DEF'.
      append imara.
      imara-matnr = 'GHI'.
      imara-mtart = 'ZCFG'.
      imara-maktx = 'This is description for GHI'.
      append imara.
      loop at imara.
        if sy-tabix = 1.
          imara-color_line = 'C410'.   " color line
        endif.
        if sy-tabix = 2.          "color CELL
          clear xcolor.
          xcolor-fieldname = 'MTART'.
          xcolor-color-col = '3'.
          xcolor-color-int = '1'. "Intensified on/off
          xcolor-color-inv = '0'.
          append xcolor to imara-tcolor.
        endif.
        modify imara.
      endloop.
    endform.
    *  WRITE_REPORT
    form write_report.
      data: layout type  slis_layout_alv.
      layout-coltab_fieldname = 'TCOLOR'.
      layout-info_fieldname = 'COLOR_LINE'.
      perform build_field_catalog.
    * CALL ABAP LIST VIEWER (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                is_layout   = layout
                it_fieldcat = fieldcat
           tables
                t_outtab    = imara.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      data: fc_tmp type slis_t_fieldcat_alv with header line.
      clear: fieldcat. refresh: fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Number'.
      fc_tmp-fieldname  = 'MATNR'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '18'.
      append fc_tmp to fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Type'.
      fc_tmp-fieldname  = 'MTART'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '4'.
      append fc_tmp to fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material'.
      fc_tmp-fieldname  = 'MAKTX'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '40'.
      fc_tmp-emphasize = 'C610'.   " color column
      append fc_tmp to fieldcat.
    endform.
    Regards,
    Rich Heilman

  • How do YOU name classes? (object oriented programming)

    I am in the process of learning advanced object oriented design, and I am trying to use it in my personal programming project. I'm having a hard time implementing all of the classes I want for it because I can't think of what to call them.
    So, my question is, in object oriented design, how do you name the implementations and abstractions that you make?
    In other words, "implementations" can be thought of as "classes", and "abstractions" as "interfaces" in Java or "pure abstract classes" in C++. How do you name the classes and interfaces you make?
    For example, do you use prefixes or suffixes on your names, such as "I" for "interface" or "Impl" for "implementation"? Do you add "-able" to the end of the name of an abstraction, such as "Decoratable"? Can you always think of simple logical names for all of your classes, and it just has never been a problem for you?
    As an example of how the number of classes quickly grows, the Decorator Pattern will use at least five classes. I have no idea what I would name those in a programming project.

    drcouzelis wrote:
    Trent wrote:Theoretically speaking, you'll have multiple implementations of the Window interface, which will have their own unique names suggested by their respective purposes.  If not, then Window and its implementation should probably be merged into a single class.
    Thank you for bringing that up.
    How about this: The name of the implementation class will be HOW its implemented followed by the name of the interface.
    A "Window" interface would have implementations such as "AllegroWindow", "GTKWindow", or "HaikuWindow".
    In a video game, a "Character" interface would have implementations such as "GeneralCharacter", "ControllableCharacter", "PlayableCharacter", or "EnemyCharacter".
    Does that sound like a good idea?
    Indeed, classes are more specific than interfaces, subclasses are more specific as their superclasses... This should be reflected in their names, the name of a class that implements an interface should somehow make clear exactly what it is (e.g. what kind window). If you have a kind of window (for instance) that is really _just_ a window, nothing else, than the interface should become this class and the implementing classes should become subclasses.

  • Learning tips for Object Oriented ABAP

    Hi Gurus,
    I am in ABAP for last 1 year,
    I want to learn Object oriented ABAP can you please guide me where to start.
    Some learning material etc.
    Regards
    Bikas

    Normal ABAP is process oriented, where is OOP-ABAP is a new methodology in ABAP which uses object oriented programming.
    we have C++, java, C#, etc as OOP languages.
    ABAP has also implemented the OOP technology.
    it uses classes, methods and interfaces instead of functiongroups and function modules.
    As part of SAP’s long-standing commitment to object technology, Release 4.0
    of R/3 will contain object-oriented enhancements to the ABAP programming
    language. SAP’s object strategy is based on SAP Business Objects and now
    covers modeling, programming, interfacing, and workflow. By using principles
    like encapsulation, inheritance, and polymorphism, the object-oriented
    extensions of ABAP will support real object-oriented development. This will
    result in improvements in the areas of reusability, maintenance, and quality of
    code. SAP offers an evolutionary approach toward objects which leverages
    SAP’s own and its customers’ investments in existing business processes,
    functionality and data.
    OO ABAP
    http://www.sapgenie.com/abap/OO/eg.htm
    http://www.sapgenie.com/abap/OO/syntax.htm
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/OO/defn.htm
    Detailed
    OOPS – OO ABAP
    http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    REward points if useful.

  • Making classes talk to each other, getting my head around object-oriented

    How many questions can I ask before people get annoyed? Hope I'm not asking too many. This is probably a dumb question, but trying to do this whole object-oriented thing is making my head spin. I want my program to make something happen in Panel 2 when there's a mouse event in Panel 1 and vice versa. In psuedo-code (very pseudo):
    panel1.addMouseListener(new MousyListener());
    private class MousyListener implements MouseListener
              public void mouseEntered(MouseEvent event) {
                   Make stuff happen in panel2
    I don't even know where to start. I've looked at the tutorials,I've looked in my books, but I still as confused as ever. Could someone please give me a hint as to how I make this happen?

    codinatrix wrote:
    How many questions can I ask before people get annoyed? Hope I'm not asking too many. You can ask as many questions as you like.
    What is annoying is when people cross post the same question. Or when people ask 37 obviously exam type questions in the span of 5 minutes. But as you're not doing either of those don't worry about it.
    This is probably a dumb question, My personal motto (gained by my personal experience) is "there's no question so profound you won't feel like an idiot later for not knowing".
    but trying to do this whole object-oriented thing is making my head spin.Ah yes. It will do that.
    I want my program to make something happen in Panel 2 when there's a mouse event in Panel 1 and vice versa. In psuedo-code (very pseudo):A number of suggestions for you.
    1) When posting code on this forum please make sure and use the code formatting tags. You can do this by selected the code in the posting message box and clicking the CODE button.
    2) I would stay well clear of Swing for awhile. It (and GUI in general for that matter) is not the easiest way to learn OO ness. In fact, in my opinion, it's about the hardest. I don't know where you are with your learning and what you know and don't know though so this may be out of place. If not though I would recommend one to play around with interfaces and abstract classes for awhile. I think once one understands the point of an abstract class one is well on the way to a solid foundation of Java OOness.
    3) This will contradict point 2 but for Swing you should learn about the MVC pattern. Here are a couple of links on the subject http://en.wikipedia.org/wiki/Model-view-controller and http://java.sun.com/blueprints/patterns/MVC.html
    MVC is important because it explains the how-to and why of what one should do with OOness when it comes to GUI.
    4) Don't be afraid to get it wrong. The best way to learn this stuff is by practice. Do it in a way you understand and that makes it work. Then go back and think how you could do it better. Think about how you could encapsulate your classes. Think about how you can seperate the logic of your application from the GUI.
    Good luck.

  • Declaration Error for Object orient Programming

    Hi All,
    can any tell me how to export Select-options .This is an object oriented question
    include ztest.
    select-options   : s_werks for marc-werks obligatory,
                       s_matnr for mara-matnr obligatory.
    data : O_object type ref to lcl_test.
    start-of-selection.
    CREATE OBJECT O_object EXPORTING IM_S_WERKS[] IN S_WERKS[]
                                     IM_S_LGORT[] in s_matnr[].
    Above statment is the problem 
    This is my include ztest.
    CLASS lcl_test DEFINITION.
    METHODS constructor IMPORTING IMWERKS[]   TYPE MARC-WERKS
                                   imLGORT[]   TYPE MARD-LGORT.
    Above statment is the problem
    endclass.
    Can anyone tell me how to declare
    Thanks
    Adi

    Hi Rich,
    This is what i have
    start-of-selection.
    CREATE OBJECT O_IMARD EXPORTING IM_WERKS = S_WERKS[].
    CLASS lcl_par DEFINITION.
    public section.
    TYPES: t_werks TYPE RANGE OF werks.
    DATA: r_werks TYPE t_werks.
    *types : begin of iwerks ,
    *SIGN(2) type c,
    *OPTION(2) type c,
    *low(4) type c,
    *high(4) type c,
    *end of iwerks.
    METHODS: constructor IMPORTING im_werks TYPE t_werks.
    endclass.
    CLASS lcl_par implementation.
    METHOD constructor.
    r_werks = im_werks.
    endmethod.
    endclass.
    My PROGRAM THROWS AN ERROR SAYINGS
    S_WERKS IS NOT COMPATABILE WITH IM_WERKS
    Let me know whats the issue in here
    Thanks
    Adi

  • Explain an object-oriented method for a conversion between the E/R diagram

    Somebody can explain me with an example an object-oriented method for a conversion between the E/R diagram and a relational database schema.
    Thanks,

    Hello here are some tips regarding how to convert ERD into Relational objects.
    (1) One to many relationships:
    One to many relationships can be explained by following example.
    Take example of department and Employee. One employee can work in one department only but one department can have more then one employees. In one to many relationship Primary key of One side (here department table) goes to Many side as foreign key (here Employee table).
    (2) Many to Many relationships:
    Many to many relationships can be explained by following example.
    One student can take many subjects and one subject can be taken by more then one student.
    In this case one new table emerges which includes Primary keys of both the tables and establish composite primary key. e.g. here if PK of student is student_id and Pk of course is course_id then new table will emerge named (say) student_course with composite primary key of student_id and course_id (student_id and course_id are also foreign keys)
    (3) One to One:
    Example: A person can have only one tax file number and one tax file number can be allocated to only one person. In this case PK of any table can go to another table as foreign key.
    (4) Super class-sub class relationship:
    Example: person can be a man or woman. Such kinds of relationships are called super class- sub class relationship. There are many ways to convert such relationship into tables
    we can make one table for super class (eg Table Person) and we can put PK of super class in subclass as primary key (eg if person_id is pk of table person then it will go in both sub classes (man, woman) as Pk and it will also be foreign key of the super class (person)
    Note: This is just a way to solve super class relationships there are many other ways which you can choose.
    Thanks
    Ish

  • Anyone recommends a good book for object oriented programming

    I am a college student in computer engineering (Software) and have been programming using Java for over a year. I have become really interested in the design of softwares and the "beauty" of object oriented programming, and thus would like to advance my knowledge about the topic (my university offers an advanced oop class but I would have to wait another 6 months to take it). So my question is, could you recommend me any book that covers the subject of object oriented programming extensively? (I have learned most of the oop I know from "An Introduction to Programming and Object Oriented Design Using Java" by Nino and Hosch.
    Thanks in advance

    Some years ago I remember cutting my teeth on OOP using an excellent book by Grady Booch. If it's still in print and has been updated, it may be worth a look. Again it was decent. Also consider picking up a book on design patterns. Good luck.
    Edit: I found it, it's called "Object-Oriented Analysis and Design with Applications", and it's in its third edition. You can find it here on Amazon.
    Edited by: Encephalopathic on Apr 22, 2008 2:48 PM

  • Anyone recommends a good book for object oriented programming (advanced)

    I am a college student in computer engineering (Software) and have been programming using Java for over a year. I have become really interested in the design of softwares and the "beauty" of object oriented programming, and thus would like to advance my knowledge about the topic (my university offers an advanced oop class but I would have to wait another 6 months to take it). So my question is, could you recommend me any book that covers the subject of object oriented programming extensively? (I have learned most of the oop I know from "An Introduction to Programming and Object Oriented Design Using Java" by Nino and Hosch.
    Thanks in advance

    jwenting wrote:
    I never tire of pushing ["Agile Software Development, Principles, Patterns, and Practices "|http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445] by Robert Martin.
    You probably meant [Agile Software Development, Principles, Patterns, and Practices|http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445] ;-)
    Remember, quotes in link names break the forum ...

Maybe you are looking for

  • Unable to see local (LAN)_share drive and pc on server 2012

    Hello,  we have windows server 2012 and almost everything is working well.  we have installed AD and domain controllers but we do not use domain controllers.  we use mostly for RDP connection. What we are trying to do is that other users on the same

  • FF crashes

    FireFox crashes as soon as I try to open it. I have found a critical error (below) and would like to know if it is the cause, and if it is, how do I fix it? Thanks. Log Name: System Source: Microsoft-Windows-Kernel-Power Date: 31/01/2014 12:30:54 Eve

  • After the latest update 10.9.2 my macbook pro wont preview pdf in safari or chrome?

    After the latest update 10.9.2 on my macbook pro I cannot preview pdf in my browsers (safari and chrome), I can save the pdf and view it later though. As an example I cannot preview it in my gmail, instead of adobe little icon there is a question mar

  • Shapes, Smart Art not showing in PDF from Word 2007

    Hi, I am having a strange problem. When I convert my Word 2007 document to PDF using Acrobat PDF, all the shapes and smart art that I created in Word 2007 is not appearing in the PDF. However, when I am converting either Microsoft Powerpoint or Micro

  • Working with Loaders (DXF)

    Hey everyone, I am new to Java 3D and I have been reading through the Java tutorial. I just got to the chapter about loaders (this stuff is really cool). So anyway, I want to load DXF files. So I did a search and found a DXF loader at: http://www.ncs