Class Creation

I'm trying to create a class that represents all 52 playing card (Suit and Value), and I'm having difficulties. I'll then create a function in my Document class that compares two card objects as parameters and traces out which one would win in a fight (aka War).

Its more along the lines of how do I get started. This is part of my homework for my Intro to Programming class. What I have so far is
package cardCode
     import flash.display.MovieClip;
     public class Card extends MovieClip
          public var cardValue:Number;
          public var cardSuit:String;
          public function card() {
          // constructor code
I don't know how to go about assigning values and suits. The final outcome wil be so that you can compare two cards and a trace statement will appear stating which card wins.

Similar Messages

  • ABAP class creation

    I would like to know what is ABAP class creation (Table API). Also would like to know how is it related to SAP BW reports.

    Are you talking about creating a ABAP class via SE24?
    Regards,
    Rich Heilman

  • Message class creation

    Can any body tell me how to creat message class and also the message numbers in the class.
    like in message class F2 the message number is 273 for giving error message if find the same VAT registration number during creation of customer master.
    Rgds.
    Laxmikanta Das.

    Hi Das
    F2 is standard message class. Dont change the standard. (SE91) Copy the F2 into Z.... Save the new message class. Inside the message class,Message number 000 to 999 is display. Here add your own messages.
    Shobana
    Edited by: shobana V on Jan 17, 2008 9:10 AM

  • Dynamic class creation

    hi,
    I need to create new classes (not objects) dynamically in my program and then objects of that type.
    For example if the user asks to create a class with int, float & char as its data fields, and such class is not yet defined, I need to create such class and then instantiate it.
    I m creating class.java using and then compiling it using Runtime.getRuntime.exec() to get corresponding class file.
    But I m facing problem in instantiating it.
    code goes like this:
    import java.util.*;
    import java.io.*;
    public class Main {
                public Main() {
        public static void main(String[] args) {
            String key="fi";
            Hashtable hs= new Hashtable();
            if(hs.contains(key))
            else
               // hs.put(key,)
               try{
                   PrintWriter pw = new PrintWriter(new FileOutputStream(key+".java"),true);  
                  pw.println("public class "+key+"{");
                   for(int i=0; i< key.length(); i++)
                       char c = key.charAt(i);
                       switch( c )
                           case 'i' : pw.println("int i;");
                            break;
                           case 'f' : pw.println ("float f;");
                           break;
                   pw.println("public " + key + " next=null; ");
                   pw.println("public static int count=0;");
                   pw.println("public "+ key +" first=null;");
                   pw.println("public "+ key +" last=null;");
                   pw.println("public static int delta=0;");
                   pw.println("}");
                Runtime.getRuntime().exec("javac " +key+ ".java");
               catch(Exception e){e.printStackTrace();}
    //           key1 in =new key1();
               //fi in = new fi;
    }    Now after try catch block I m trying instantiate the class whose name is in key. (here key value is fi and I need create instnce of fi)

    No, The classloader associated with a class is the one that loaded it, which in the case of System.class will be the primordial class loader which "loads" classes which are actually built into the JVM. It probably won't even see the ClassPath, You'd be better putting the class files you generate on the fly into a special folder reserved for that purpose and create a URLClassLoader to load them.
    However, as has been pointed out, the question is; how are you going to use them? In general, dynamically loaded classes are only useful if they are known to implement an interface, or extend a class, available at compile time. It's pointless to create a class as a container object, for example, because if you can only access the fields through reflection it's slower, and more complicated, than using something like a HashMap.

  • IPM & CIS and Document Class creation

    If I've to setup a new Content Management System with process management, what are the advantages I get if I integrate UCM with IPM?
    1. Can't IPM provide the versioning and document management features?
    2. How can I create various document classes (as in Documentum, FileNet)? The idea is to create various document classes and associate folders and workflows with those classes. Thus once created, documents automatically go into workflow. Note that workflows can be associated with folders. I want them to be associated with document types.
    Thanks

    Its more along the lines of how do I get started. This is part of my homework for my Intro to Programming class. What I have so far is
    package cardCode
         import flash.display.MovieClip;
         public class Card extends MovieClip
              public var cardValue:Number;
              public var cardSuit:String;
              public function card() {
              // constructor code
    I don't know how to go about assigning values and suits. The final outcome wil be so that you can compare two cards and a trace statement will appear stating which card wins.

  • Class Creation Problem in Publish settings

    now iam working in flash 8 version .fla file.......firstly iam save as it to cs4 via Macromedia flash cs4....when i trying to add a new main class for this file
    it showing error as
    "This feature is not supported by flash 8 , Action script 2.0,to use this feature ,you must flash player 9,Action script 3.0"
    but when i publish this to flash player 9,Action script 3.0 it not working properly..........is there any suggestion to avoid this problem???????

    if you want to use a document class, you must publish for as3.  if you're using as2 code, you'll need to change all the code to as3.
    the simplest solution is to leave it an as2 file and not use a document class.
    or, you could create a main as3 swf that has a document class and load your as2 swf into your main as3 swf.

  • Class creation at Runtime?

    Hi,
    How can I create a class at Runtime? I want to create multiple classes having structure (say):
    public class MyClass{
       public void myMethod(){
            System.out.println("Some Text")
    }Now I want to create multiple classes at runtime having name "MyClass1.class", "MyClass2.class", ......
    Please Help.
    Thanks,
    Sumit

    Actually, I want those multiple classes
    ("Myclass1.class", "Myclass2.class".....) to be
    present physically on the machine. As some other
    program then going to load those classes later on.
    Any Solution?How about defining a single class, whose instances can be described with a standard set of data. Say, that data could be represented by java.util.Properties object, and this class will have a constructor that takes a Properties as an argument.
    Then this other program will load files in the format used by Properties, then it will use Properties.load() to load the data from these files, and then instantiate the class. Rather than loading lots of different classes.
    Or not. It's up to you.

  • Dynamic Server_Stub.class creation -- will it really happen??

    hi
    I am using jdk 1.5.0 and my server code is like this
    import java.rmi.*;
    import java.rmi.server.*;
    import java.net.*;
    public class Server   implements RemoteInterface{
    public Server() throws RemoteException{
         super();
    public static void main(String[] s ){
              try{
                   Server server = new Server();
                   UnicastRemoteObject.exportObject(server);
                   Naming.rebind("Server",server);
              System.out.println("Bound");
              System.out.println(server.getAdvice(0));
              }catch(RemoteException e){
                   e.printStackTrace();
              }catch(MalformedURLException ue){
                        ue.printStackTrace();
    public String  getAdvice(int adviceNo) throws RemoteException{
         String [] advices = { "Don't lie", "Do always Good","Keep Chantic sacred names of God"};
         return advices[adviceNo];
    }when i tried to run this it thows this exception without creating the stub
            java.lang.ClassNotFoundException: Server_Stub
            at sun.rmi.server.Util.createStub(Unknown Source)
            at sun.rmi.server.Util.createProxy(Unknown Source)
            at sun.rmi.server.UnicastServerRef.exportObject(Unknown Source)
            at java.rmi.server.UnicastRemoteObject.exportObject(Unknown Source)
            at java.rmi.server.UnicastRemoteObject.exportObject(Unknown Source)
            at Server.main(Server.java:17)
    Caused by: java.lang.ClassNotFoundException: Server_Stub
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            ... 6 morebut when i create is mannualy using rmic
    it will run smoothly
    why is this behaviour??

    You want UnicastRemoteObject.exportObject(server,0);See the footnote in the RMI release notes for the reason why.
    http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html#callout

  • Reg Valuation class creation

    Dear SAP Genius
    pls explain how to create the valuation class and how to assign G/L account to the valuation class.
    pls explain this step by step.
    Regards
    irshath

    Dear CB
    i have create cost element as 4000108.
    i create a purchase order.
    i get error when i post goods receipt in MIGO t-code
    Error is below
    Account determination for entry ECCI EIN ____ ___ 4072 not possible
    Message no. M8147
    Diagnosis
    The system did not find an account for this transaction. This means that the account determination for key ECCI EIN ____ ___ 4072 is not maintained in MM Customizing (Valuation). The key is made up of:
    Chart of account
    Transaction key (= Posting transaction)
    Valuation grouping code
    Account grouping code
    Valuation class
    System Response
    The system cannot update a G/L account for this transaction. You cannot post the transaction.
    Procedure
    Contact your system administrator.
    If you have the authorization, check the Account determination in Customizing for Valuation.
    Proceed
    Note
    The relevant posting transaction can be found in Table T030A.
    pls help me to update Goods Receipt

  • Very basic noob question about understanding class creation

    After learing some procedural scripting I just started with understanding OOP and have a problem with a basic stuff like this. Why my Try.as below is not working when I type Try(1); in the main file. Output says: Type Coercion failed: cannot convert 1 to Try
    package {
        public class Try {
            public function Try(some:Number) {
                some += 1;
                 trace (some);

    use:
    var s:Try = new Try(3);

  • Alert class creation

    Hi all,
    Please send me steps to crete an user defined alert class(e.g alert for solutions taking data from solution database) for CRM IC web client(CRM5.0).
    Thanks
    Rana

    Hi Koustav Saha ,
    3.1.3.5.1     Creating New Class
    Procedure
    1.     Access the activity using one of the following navigation options:
    Transaction code     SE80
    SAP CRM menu     Architecture and Technology &#61664; ABAP Workbench &#61664; Overview &#61664; Object Navigator
    2.     Enter the following data:
    Field name     User action and values
    Object     Class / Interface
    Class ID     YCL_BP_ALERT
    3.     Press ENTER.
    4.     In the Create Object dialog box choose Yes.
    5.     In the Create Class <ID> dialog box enter the following data and choose Save:
    Field name     User action and values
    Class     YCL_BP_ALERT
    Description     SAP Best Practices - ICWeb Alert
    Instantiation     Public
    Usual ABAP Class     
    Final     
    6.     Choose Save, select a package (e.g., $TMP) and choose Save again.
    7.     Double-click in the object name of the new class, then choose Display <-> Change.
    8.     On tab Properties choose button Superclass.
    9.     Maintain the following value and choose Enter:
    Field name     User action and values
    Superclass     CL_BSP_WD_CUSTOM_CONTROLLER
    10.     On tab Interfaces maintain the following values and choose Enter:
    Field name     User action and values
    Interface     IF_CRM_IC_EVENT_LISTENER
    Abstract     <empty>
    Final     <empty>
    Modeled only     <empty>
    11.     Save your entries.
    Defining first method CONSTRUCTOR:
    This method necessary to register for the event “Business Partner Confirmed”:
    1.     Select tab Methods.
    2.     To create a new entry for method CONSTRUCTOR choose button Create constructor.
    3.     Double-click on new method entry CONSTRUCTOR.
    4.     To change the coding choose Display <-> Change.
    5.     Replace the existing coding with the following:
    METHOD CONSTRUCTOR.
      DATA: lr_ic_event_srv TYPE REF TO  if_crm_ic_event_srv.
      super->constructor( ).
    subscribe to events which should be handled
      lr_ic_event_srv = cl_crm_ic_services=>get_event_srv_instance( ).
      lr_ic_event_srv->subscribe( event_name = if_crm_ic_events_con=>gc_bpconfirmed
                                  listener   = me ).
    ENDMETHOD.
    6.     Save your entries and select a workbench request if necessary.
    7.     Choose Activate to activate the modified method.
    8.     Choose Back.
    Defining second method IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT:
    The second method IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT is called when the event BP confirmed is raised. First, the event name is checked, and then the classification of the business partner is selected form the database. For customers with classification “YG” our new event YBP_GoldCustomer is raised (see additional settings in the chapters below).
    1.     On tab Methods double-click on method IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT.
    2.     Replace the existing default coding with the following:
    METHOD if_crm_ic_event_listener~handle_event.
      DATA: lv_name      TYPE string,
            lr_bdc       TYPE REF TO cl_crm_ic_cucobdc_impl,
            lv_bpguid    TYPE bu_partner_guid,
            lv_classific TYPE crmt_bu_cust_classific,
            lr_event     TYPE REF TO cl_crm_ic_event,
            lr_event_srv TYPE REF TO if_crm_ic_event_srv.
      TRY.
          lv_name = event->get_name( ).
          IF lv_name = if_crm_ic_events_con=>gc_bpconfirmed.
          Check if business partner is a GOLD customer
            lr_bdc ?= cl_crm_ic_services=>contextarea_contr->get_custom_controller( 'CuCoBDC' ).
            IF lr_bdc IS BOUND.
            Get Business Partner GUID
              CALL METHOD lr_bdc->get_xpath_property_as_value
                EXPORTING
                  iv_xpath  = '//currentCustomer/BP_GUID'
                IMPORTING
                  ev_result = lv_bpguid.
            Get classification
              SELECT SINGLE classific FROM crmm_but_frg0041 INTO lv_classific
                      WHERE partner_guid = lv_bpguid.
              IF lv_classific = 'YG'.
              Raise new event "Gold Customer"
                CREATE OBJECT lr_event.
                lr_event->set_name( 'YBP_GoldCustomer' ).
                lr_event_srv = cl_crm_ic_services=>get_event_srv_instance( ).
                lr_event_srv->raise( lr_event ).
              ENDIF.
            ENDIF.
          ENDIF.
        CATCH cx_root.
      ENDTRY.
    ENDMETHOD.
    3.     Save your entries and select a workbench request if necessary.
    4.     Choose Activate to activate the modified method.
    5.     Choose Back.
    Thanks&Regards
    VEERA.

  • Common class creation

    Hello Anybody,
    In my application, I have nearly ten different forms, where i have to take picture from album/camera using UIImagePickerController. So instead of using the UIImagePickerController in ten view controllers, I wish to use it as a common class.
    So how can I make this possible? Please advice me with example.
    Nalan.

    Why not have a base controller class that implements all the common features, and then sub-class that for your individual controllers?

  • Development Class creation and migration?

    How do we create the development class?Please explain and also is it normal procedure to migrate the development class or it is differnet?
    Poitns will be definitley assigned.
    Before transporting any object which are avialable in that Development class Do I need to first transport the Development class and then I need to tranpsport the other objects right?
    Edited by: Ravi Kumar on Dec 2, 2009 1:54 PM

    Try this:
    1) Go to tcode SE80
    2) Click on Other Object button
    3) Go to the More... tab and ensure the Development Class radio button is selected
    4) Type in the Name of the Development Class (must begin with Z or Y)
    5) Click on the Create button
    6) Enter a Description for the Development Class
    7) Click on Save
    8) A Workbench Request (transport) popup should appear for you to assign the Development class to a transportable package and add to a transport
    This Development Class needs to be transported throughout the landscape prior to any objects being transported through the landscape (e.g. the Development Class must be in QA prior to objects developed on that Development Class being moved to QA).

  • Proxy class creation using wsdl

    Hi Everyone
    There is a web service already running and what i have is the wsdl of that web service. How do i create the proxy classes for this webservice using the JWSDP
    Please help its urgent. Or atleasst direct me to any links for this query. Any help is welcome
    Thanks in advance
    Maria

    Edit a file named config.xml :
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration
    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <wsdl location="http://{path}/{serviceName}?WSDL"
    packageName="client">
    </wsdl>
    </configuration>
    and try this command : xrpcc -client config.xml
    It will generate all the client-side classes.
    Finally, write a client that accesses to these classes.
    package client;
    import javax.xml.rpc.Stub;
    public class Client {
    public static void main(String[] args) {
    try {
              Stub stub = createProxy();
              stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,args[0]);
              CITClientIF_Stub cl = (CITClientIF_Stub)stub;
              result=cl.Method(...);
    } catch (Exception ex) {
    ex.printStackTrace();
    private static Stub createProxy() {
    return (Stub)(new MyCIT_Impl().getCITClientIFPort());

  • ApplicationModule Class creation and then delete?

    Hi all,
    sorry if the question sound weird,
    what if I created the AppModuleImpl.java
    then figured that no need for any modification on it,
    what would be the implication of deleting the created implementation file , (right Click -> delete -> and delete all the usages of the java files in the AppModule.xml)
    same is for the view Implementation classes.
    as far as I know, that at run time the super implementation classes executed based on the specific properties for each e.g: view from the xml files.
    regards
    Edited by: Knowledgestudent on Nov 25, 2010 4:25 AM

    If I get your question right, there should be no problem deleting the applicationModuleImpl java file. You normally don't delete it this way. To remove the impl file you open the application module, select the 'Java' node, click the pencil and remove the check mark from 'Generate Application...'.
    Timo

Maybe you are looking for

  • Installing j2 sdk 1.4.2 on i386

    I have downloaded j2sdk-1_4_2-windows-i586.exe and started installing. The installation did not work. I would like to know whether I have any hope of succeeding, given that I have a i386 processor. Does anybody here has installed j2 sdk (of any versi

  • Include authority check in PM User exit

    Dear all, Is there any user exit for adding an authority check object in IW31 transaction program? Kindly advise. Thanks.

  • What version of Photoshop do I need to open PSDX files?

    I have a tablet with PS Touch, and a copy of Photoshop CS4.  Can I open PS Touch PSDX files in my version of Photoshop?

  • APin 7.4 and WLC inver 7.022??

    Hello another question, can i mangane a AP in 7.4 with a WLC in 7.0.2.2? This situation will be temporarly, time to upgrade my other WLC, i need to move them from 1 to another... Tx for an answer. B

  • After updating my 3GS with ios5, my BMW usb interface no longer works

    After updating my iPhone 3gs with ios 5, my BMW usb interface no longer works.  I can no longer see my music on the screen and cannot control my music.  I tried my old Nano in my car and that works so I'm thinking it must be something with ios 5.  An