Driver program question

i am a student who is in an intro to java course. my question
involves using a driver program. my assignment is to create a
driver program that prints out 20 random playing cards. i wrote
a card class that looks like this class Card
     private String suit;
     private String face;     
     public Card (String suit, String face)
     public String getSuit()
               return suit;
     public String getFace()
               return face;
     public String toString()
               return (suit+" "+face);
}first, is this the correct code will need for the driver class,
and 2nd, if it is correct, how exactly would i set up the driver program.
i know that i would use a for loop to get it to print 20 times, but im not
exactly sure how the two programs interact with each other ( how info in
one is passed to the other and vice versa) i also think i am goin to do 2
switch statements to get the face(ie 2,5, king) and the suit( heart, club)
and for each switch statement i am generating a random # (suit 0-3) and
face(0-12). where would i need to put these switch statemetns in the
driver program? i have some basic swtich statemetns i have written
and if anyone would like to see what im talking about ill post them

Make a Deck class which will hold 52 cards. Create the cards in the constructor of Deck. Add a shuffle() method to the Deck (See the Arrays class - hint, hint). Then your 'driver' becomesclass CardDriver {
    public static void main(String[] args) {
        Deck myDeck = new Deck();
        myDeck.shuffle();
        for (int i=0; i<20; i++) {
            System.out.println("Card "+i+" is "+myDeck.getCard(i));
}

Similar Messages

  • Calling a driver program by submit in user exit for PGI

    Hi Gurus,
    I have a question regarding post goods issue (PGI) for transaction vl01n,vl02n and vl06g.
    earlier i have created a smartofrm and a driver program for sending the form output attachment in a mail after delivery posting manually.
    for this i have created a smartform and driver program in which all the logic to attach and mail send is written on delivery posting.
    but now customer want this fucntionality on Post goods issue (PGI), when user go to trasaction vl01n ,vl02n and vlo6g and pressing PGI button,
    then mail should be sent automatically with for output attachment.
    i have found a user exit which is being triggerd on PGI press MV50AFZ1 in which implemented the implecit enhancement in perform
    user_exit_save_document_prepeare with below code.
    ENHANCEMENT 1  ZPGI_MAIL_SEND.    "active version
    DATA c_zlf TYPE likp-lfart.
    IF sy-ucomm = 'WABU_T' and xlikp-lfart = c_zlf.
    SUBMIT ZSD_DECLARATION_CONFORMITY AND RETURN.
    ENDIF.
    ENDENHANCEMENT.
    After going to transaction vl02n i am putting unposted delivery number and clicking on PGI button.
    in debugging its going to condition check for ucomm for PGI buttion and delivery type.
    if condtion is fullfiled and curser going further on submit statement, but without executing the driver program ZSD_DECLARATION_CONFORMITY it coming out of enhancement.
    its not performing the task which is develped in the driver program.
    Please help me with the submit statement structure if i am missing any or other solution for my problem.
    Br,
    Surya

    Hi Team,
    I have used the perform.
    ENHANCEMENT 1  ZPGI_MAIL_SEND.    "active version
    DATA c_zlf TYPE likp-lfart.
    IF sy-ucomm = 'WABU_T' and xlikp-lfart = c_zlf.
    Perform entry( ZSD_DECLARATION_CONFORMITY )using return screen.
    ENDIF.
    ENDENHANCEMENT.
    Now i am able to communicate with my program.
    Thanks,
    surya

  • Problem in smart forms &Driver program..urgent....

    Hi friends ,
              I am having 4 windows  in a page ,
              I am having 4 wa as wa1, wa2, wa3, wa4 in my driver program of SF.
    for ex my itab is hving 10 lines , i am passing first line of my itab to wa1 and print in First window of  page 1, second line to wa2 and second  window /page1....
    4 line of itab to wa4 dispaly in 4 th wind/pag1.
    5,6,7,8, lines of itab in again wa1,wa2, wa3 ,wa4 into window 1,2,3,4 of page 2 and
    9,10 lines of itab in wa1,wa2 into win1 , win 2 of page 3. For ex my itab can hve 'n' lines....this is the scenerio...
    my question is .........
    1. how can i always take 4 line pass in wa1 , wa2 3 & 4 , then go for next four , then rest ........in my driver program....
    2. In Sf after complition of 1st four in page 1 , how it will move next four to page 2, rest in page 3.....
    can any one help me ...it is very urgent....advance thanks,
    Reagrds
    LAkshmi..)....

    Hi ,
    Goto Global Settings -> Form Attributes
    In the Form Attributes,click the General attributes tab you will find the package name of the smartform.
    Regards
    DV

  • Issue with  driver program ZSAPM07DR(From where this Program is called)

    Hi All,
    We need  to find out from  where the driver program  ZSAPM07DR(this is a customized program of SAPM07DR). It has the
    form  Z_DLYNOTE .
       So how to know from  which place the Driver program is called.
    Please help .
    Thanks and Regards
    Channappa Sajjanar

    Hi,
    It is me not totally clear what you want with this question.
    I think you are asking this because you want to change the calling program in such a way that is using the new ZSAPM07DR instead of SAPM07DR.
    For this you do not have to change a program. This can be done by making settings (a kind of customizing).
    Your print will be made with a certain outputtype. (ithink 1 of WA01, Wa02,Wa03, wae1, wae2, wae3, wee1, wee2, wee3, wf01, wf02, wlb1, wlb2, wlb3) with apllicationtype ME.
    The settings can be made with transaction NACE.
    for your program> start transaction NACE
                                  click on application ME
                                  click on outputtype
                                  doubleclick on the right outputtype
    then you see a prgram, a starting routine, and  sapscript or smartform name.
    Here you change your settings to your program and your sapscript or smartform or adobe interactive forms.
    and save.
    these setting are stored in table TNAPR.
    Hope this helps you. success.
    Gr., Frank

  • Emailing of PO - Where in SAPFM06P (Driver program for MEDRUCK)?

    Just a little bit of background, I used Vijaya Lakshmi's smartform driver that replicated the contents of the standard sapscript driver SAPFM06P (see [Printing Purchase Order from ME9F using custom program and smartform; and [http://vjkvijaya.blogspot.com/2009/03/puchace-order-smartform-driver-program.html]). But it does not send the email so I examined the code of the standard driver.
    External Output (email) has a medium (TNAPR-NACHA) of 5. I searched for the text "nacha" in SAPFM06P and It's inside the subroutine adobe_print_output (in include FM06PE04). It also shows there how adobe forms are emailed. This subroutine is only called in adobe_entry_neu (in include FM06PE03). For the entry subroutine of MEDRUCK, entry_neu, only calls to 2 functions are there: ME_READ_PO_FOR_PRINTING, and ME_PRINT_PO.
    Now, the question: How does SAPFM06P handle the NEU medium 5 for emails? (especially also the queueing in transaction SCOT)
    I tried replacing ENTRY_NEU with ADOBE_ENTRY_NEU in transaction NACE but this actually is for Adobe forms (of which I am not familiar) and since there is no corresponding adobe form, i had an error.
    I tried examining the function ME_PRINT_PO but I mostly see sapscript calls (open_form, write_form, close_form). Although I haven't dug deep enough into this rabbit hole, I feel that the email handling is not here, though I am not certain as well.
    Any insights that would point me in the right direction will be appreciated.
    Kyle

    Anyone??

  • Bounded int beed help making a test driver  program

    Bounded int here's my code i want to make a test drive program
    getLowerBound that returns the lower bound for the object
    getUpperBound that returns the upper bound for the object
    getValue that returns the current value for the object
    setValue that modifies the value for the object - if the value passed to the method is within the bounds then the value can be changed, however if the value is outside the legal range then the value should not be changed
    public class BoundedInt{
    private static final int intLowerBound = 3;
    private static final int intUpperBound = 10;
    private int value;
    public BoundedInt() {
    this.value = 3;
    public void setValue (int tempValue) {
    if(tempValue < intUpperBound && tempValue > intLowerBound) {
    this.value = tempValue;
    public int getValue () {
         return value;
    public int getLowerBound () {
         return intLowerBound;
    public int getUpperBound () {
         return intUpperBound;
    this is my test drive program (i dont know if i did it right) when i compile it it gives me this error am i doing some thing wrong or i may b missing some line of code ??
    import java.util.*;
    public class testdriver {
    public static void main(String[] args) {
    Scanner scan = new Scanner (System.in);
    BoundedInt b = new BoundedInt(2);
    System.out.println(b);
    out put : testdriver.java:30: cannot find symbol
    symbol : constructor BoundedInt(int)
    location: class BoundedInt
    BoundedInt b = new BoundedInt(2);

    1) When you post code, use the CODE button or [code] and [/code] tags to preserve formatting and make your code readable. Copy/paste from your original source in your editor, NOT from your post here, which has already lost all formatting. Most of us won't even bother reading your post otherwise.
    2) What is your question. Don't say, "How do I make a test driver?"

  • Error by installation "Gear driver program cannot be installed"

    The message in Dutch:
    Het GEAR-stuurprogramma kan momenteel niet worden geinstalleerd. Het gebruik van de GEARAspiWD-voorziening door het GEAR-stuuprogramma wordt verwijderd als het systeem opnieuw wordt opgestart. Start het systeem opnieuw op en voer iTunes opnieuw uit.
    My best translation:
    The Gear driver program cannot be installed. The use of GEARAspiWD by the GEAR driver program will be removed if the system is rebooted. Reboot the system and install iTunes again.
    I tried a reboot, removed quicktime (old version), but I still get this error. Can ayone help?
    I use the same iTunes installer for my laptop and that went fine...

    Please refer to the Deployment Overview for Lync Server 2013
    https://technet.microsoft.com/en-us/library/gg412892(v=ocs.15).aspx
    Answer to your question: Yes, You cannot install lync server on the Active Diretory.

  • How to deal with visession in IVI-C driver program ?

    a ViSession is an identifier that corresponds to a session.
    My instrument is a remote internet device . i can call VISA library to implement
    communication between labwindows and my remote internet device.In this case , what is meaning of Visession
    ? It looks as if Visession does not have a relation to my IVI-C driver program.
    if it has a relation to my driver, how to deal with the ViSession in IVI-C driver program?thank you

    ViSession is necessary as part of a larger picture and fills an important role in good architecture.  Intrument handles (stored as the ViSession type) are necessary for large projects, which may require commanding multiple instruments.
    There is no function to call which can get or set a ViSession value, similar to the way other attributes are set with driver functions.  The ViSession intrument handle is created and returned to the application when an instrument is initialized; it represents a connection with one particular instrument.
    This allows users to have multiple instruments connected, which can be controlled programmatically with one application.  Then, the application can quickly specify which instrument it would like to send a command, just by sending one instrument handle or another.
    Yes, you could remove the ViSession as parameter in your functions, but it would cripple the big picture effectiveness of the driver.  In place of the ViSession, you would have to send each function the Resource Name or Resource ID for the particular instrument as well as the Option String.  So really, it is just more practical and better practice to use an instrument handle (stored as the ViSession type).
    That being said, for certain functionality (adding two numbers), you absolutely do not need a ViSession instrument handle parameter.  You will have to use your best judgement to determine where to include or exclude this parameter.  I suggest using the ViSession instrument handle parameter with any function that communicates with an instrument.
    Also, Ebalci is correct regarding the difference between ViSessions and channels.  ViSessions are used to communicate with different instruments.  To reference or read a specific channel from an instrument you will have to refer to the guidance in the manual for the instrument in question.  There will likely be a command to select a specific channel when reading from the instrument.  And for general guidance, I suggest reviewing another IVI driver, possibly for an instrument of the same class or type or maybe from the same family, if such a driver already exists.
    Regards,
    Shawn S. | NIC
    Instrument Driver/IVI PSE
    National Instruments

  • Looking for driver program

    I'm looking for a driver program of PCI-6602 counter-board for real-time OS
    VxWorks. If anybody knows a vendor of such driver program, let me know how
    to get it.
    Toyoji Fukui
    Tokyo Seimitsu Co., Ltd.

    I'd like to clarify some of the terms being used to hopefully help address your question.
    When communicating with an instrument there are a couple of "drivers". For the GPIB card that is used to connect to the instruments NI has NI-488.2:
    http://digital.ni.com/softlib.nsf/webcategories/85​256410006C055586256BBB002C101C?opendocument&node=1​32070_US
    VISA is also a driver and provides an abstraction for different busses. For example, you can use a VISA driver to communicate with an instrument via serial or GPIB with the same programming API.
    An instrument driver is a high level API that contains functions or VIs for generating the right commands to communicate with an instrument.
    On the Instrument Driver Network there is an instrument driver for the 4
    385A:
    https://zone.ni.com/idnet97.nsf/nidz/CB97C5E119AEE​B9586256ABF004F59E4
    This is a contirubted driver, not from NI or the manufacturer, and does not use VISA but uses GPIB VIs. The best way to determine the functionality of the driver is to open the VI in the llb that has an "_tree" suffix.
    If you have a VISA based driver that is not in LabVIEW for the instrument you may be able to convert it for use in LabVIEW. For one thing you can call into any dll. If the driver is a CVI driver you can convert it for use in LabVIEW and reduce some of the burden involved with generating the VIs:
    http://www.ni.com/support/cvi/visa/
    Regards,
    Kamran

  • Dunning report driver program

    Hi,
       I see a dunning sap script z_asia_dunning assigned in Dunning procedure.  I am interested in knowing the driver program for this dunning script. 
      I searched in SDN and failed to get this information.  Please let me know how to get a driver program for dunning report.
    Thanks in advance
    Sudhaker

    ok it IS possible
    and well the table where those connections of driver programs and form are stored is (i hope you learned that by now from the earlier posts) TNAPR.
    you are a developer, so it´s not really neccesary for you to have a transaction to chance some record in a database table.
    I would propose the TA SE16N with the fcode &sap_edit.
    then just fill in your new (copied) driver program and save

  • In sap scripts how to display the driver program

    Hi,
        I Want to know the sap scripts How to display the output to driver program

    Hi,
    Go to NACE Transaction.
    Select application for ex: if sales V1.
    Click on output types.
    Select the output type for ex : BA00
    Double click on Processing routines.
    There you can find the Driver Program name and Script/smart form name.
    Reward if useful.
    Thanks,
    Raju

  • Printing Line Items in Script without using driver program

    How to print the line items of a internal table in sap script without using driver program? I am not supposed to edit anything in the driver program. Pls help me to solve this problem...

    Hi,
    You can try by creating a new driver program and a new FORM ENDFORM inside that for this purpose.
    Regards,
    Gaurav

  • Driver Program Name for Shipment output form

    Hi guru's
    can anyone tell me wats the name of the driver program and the form name for a shipment output form?(for ABAP development purpose)
    Thanks in advance,
    Regards/Aryan

    Hi Aryan - What Shipment output are you referring to? LD01-Delivery Note? There are some more, which are associated with Transportation application as well.
    LD01 - V2 - Program SDADDN02. Form SD_DELNOTE_SUPPL
    LD00 - V2 - Program YMRVADDN01/RVADDN01 Form ZMLWMRVDELNOTE(customized our side)/RVDELNOTE
    Pl00 - Packing List -V2 - Program SDPACKLI, Form SD_PACKING_LIST
    CMR1 - Bill of lading - V7 - Progarm RVADTR01 Form SD_SHIPMENT_CMR.
    Best way, use transaction V/34 to view all V2 - Shipping output types and the associated program and form. V/82 to view all V7-Transportation output types and the associated program/forms.
    Thanks
    Nikhil

  • Driver program name

    hi all
    is there any other way of determining the driver program name for a script/smart form apart from the table tnapr?
    regards
    niki

    Hi..
    1) goto NACE transaction.
    2) select the module of the form...i.e. PO/SD/etc
    3) select the output type option
    4) from the list ,select the name of ur form/script.
    5) check out the processing routine,that will give the driver program name
    Reward Pts if helpful.
    regards
    - Rishika Bawa

  • Driver program for BIll of lading smartform

    Hi all,
    Can you please provide me the standard driver program for bill of lading smartform.
    or for purchase order smartform.
    Thanks and regards,
    Rajeev

    Hi,
      For Purchase Order - SAPFM06P.
    And for future info,
      If you Know the Application and Output Type - Then it is very easy to know the Smartform or the Script Used.
    1.Go to NACE and Check.
      For Ex: PO belong to APP type EF, So click on EF and then click on "Output Type " button.
                  Then all the output types will be displayed.Then select the required and Click on "Processing Functions". Then you can see the Configuration details done for this ouput type like which smartform, which subroutine.
    2.Also, You can check the TNAPR table entries by entring the below information
    Output Type, Message transmission medium, Application.
    Thanks & Regards,
    Vamsi.

Maybe you are looking for