Urgent: im new and need help with this task!

I need help with converting the pseudo code to java code, Any help will b greatly appreciated!
// Declare a variable of type int, called "choice".
// Generate a random number between 0 inclusive and 7
// exclusive, and store that number into the variable
// "choice". (How do you generate a random number? Use the
// nextInt(int) method inside the random object, which takes
// a single int parameter. You can read about this method
// here:
// http://java.sun.com/j2se/1.5.0/docs/api/java/util/Random.html
// If "choice" is equal to 0, then create and return a new
// IBlock object, passing "game" as the parameter to IBlock's
// constructor.
// Otherwise, if "choice" is equal to 1, then create and
// return a new TBlock object, passing "game" as the
// parameter.
// Otherwise, if "choice" is equal to 2, then create and
// return a new OBlock object, passing "game" as the
// parameter.
// Otherwise, .... etc ....
// (please continue to do this for all of the 7 kinds of block
// that can be created)

import java.util.*;
public class Echo{
     public static void main(String[] args)     {
          //System.out.println("enter ur choice");
Random r=new Random();
int choice=r.nextInt(6);
     switch(choice)
     case 0:
          IBlock object0=new IBlock("games");
          break;
     case 1:
          TBlock object1=new TBlock("games");
          break;
     case 2:
          OBlock object2=new OBlock("games");
          break;
     case 3:
          LBlock object3=new LBlock("games");
          break;
     case 4:
          JBlock object4=new JBlock("games");
          break;
     case 5:
          SBlock object5=new SBlock("games");
          break;
     case 6:
          ZBlock object6=new ZBlock("games");
          break;
class TBlock
     TBlock(String s)
          System.out.print("TBlock called"+"\n value passed is "+s);
class IBlock
     IBlock(String s)
          System.out.print("IBlock called"+"\n value passed is "+s);
class JBlock
     JBlock(String s)
          System.out.print("JBlock called"+"\n value passed is "+s);
class OBlock
     OBlock(String s)
          System.out.print("OBlock called"+"\n value passed is "+s);
class LBlock
     LBlock(String s)
          System.out.print("LBlock called"+"\n value passed is "+s);
class SBlock
     SBlock(String s)
          System.out.print("SBlock called"+"\n value passed is "+s);
class ZBlock
     ZBlock(String s)
          System.out.print("ZBlock called"+"\n value passed is "+s);
}

Similar Messages

  • New to Java and need help with this program..please!

    I'd really appreciate any helpful comments about this program assignment that I have to turn in a week from Friday. I'm taking a class one night a week and completely new to Java. I'd ask my professor for help, but we can't call him during the week and he never answers e-mails. He didn't tell us how to call from other classes yet, and I just can't get the darn thing to do what I want it to do!
    The assignment requirements are:
    1. Change a card game application that draws two cards
    and the higher card wins, to a Blackjack application
    2. Include a new class called Hand
    3. The Hand class should record the number of draws
    4. The application should prompt for a number of draws
    5. The game is played against the Dealer
    6. The dealer always draws a card if the dealer's hand total is <= 17
    7. Prompt the player after each hand if he wants to quit
    8. Display the total games won by the dealer and total and the total games wond by the player after each hand
    9. Display all of the dealer's and player's cards at the
    end of each hand
    10. Player has the option of drawing an additional card after the first two cards
    11. The Ace can have a value of 11 or 1
    (Even though it's not called for in the requirements, I would like to be able to let the Ace have a value of 1 or an 11)
    The following is my code with some comments about a few things that are driving me nuts:
    import java.util.*;
    import javax.swing.*;
    import java.text.*;
    public class CardDeck
    public CardDeck()
    deck = new Card[52];
    fill();
    shuffle();
    public void fill()
    int i;
    int j;
    for (i = 1; i <= 13; i++)
    for (j = 1; j <= 4; j++)
    deck[4 * (i - 1) + j - 1] = new Card(i, j);
    cards = 52;
    public void shuffle()
    int next;
    for (next = 0; next < cards - 1; next++)
    int rand = (int)(Math.random()*(next+1));
    Card temp = deck[next];
    deck[next] = deck[rand];
    deck[rand] = temp;
    public final Card draw()
    if (cards == 0)
    return null;
    cards--;
    return deck[cards];
    public int changeValue()
    int val = 0;
    boolean ace = false;
    int cds;
    for (int i = 0; i < cards; i++)
    if (cardValue > 10)
    cardValue = 10;
    if (cardValue ==1)     {
    ace = true;
    val = val + cardValue;
    if ( ace = true && val + 10 <= 21 )
    val = val + 10;
    return val;
    public static void main(String[] args)
    CardDeck d = new CardDeck();
    int x = 3;
    int i;
    int wins = 1;
    int playerTotal = 1;
    do {
    Card dealer = (d.draw());
    /**I've tried everything I can think of to call the ChangeValue() method after I draw the card, but nothing is working for me.**/
    System.out.println("Dealer draws: " + dealer);
    do {
    dealer = (d.draw());
    System.out.println(" " + dealer);
    }while (dealer.rank() <= 17);
    Card mine = d.draw();
    System.out.println("\t\t\t\t Player draws: "
    + mine);
    mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
    do{
    String input = JOptionPane.showInputDialog
    ("Would you like a card? ");
    if(input.equalsIgnoreCase("yes"))
         mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
         playerTotal++;
         else if(input.equalsIgnoreCase("no"))
    System.out.println("\t\t\t\t Player stands");
         else
    System.out.println("\t\tInvalid input.
    Please try again.");
    I don't know how to go about making and calling a method or class that will combine the total cards delt to the player and the total cards delt to the dealer. The rank() method only seems to give me the last cards drawn to compare with when I try to do the tests.**/
    if ((dealer.rank() > mine.rank())
    && (dealer.rank() <= 21)
    || (mine.rank() > 21)
    && (dealer.rank() < 22)
    || ((dealer.rank() == 21)
    && (mine.rank() == 21))
    || ((mine.rank() > 21)
    && (dealer.rank() <= 21)))
    System.out.println("Dealer wins");
    wins++;
         else
    System.out.println("I win!");
    break;
    } while (playerTotal <= 1);
    String stop = JOptionPane.showInputDialog
    ("Would you like to play again? ");
    if (stop.equalsIgnoreCase("no"))
    break;
    if (rounds == 5)
    System.out.println("Player wins " +
    (CardDeck.rounds - wins) + "rounds");
    } while (rounds <= 5);
    private Card[] deck;
    private int cards;
    public static int rounds = 1;
    public int cardValue;
    /**When I try to compile this nested class, I get an error message saying I need a brace here and at the end of the program. I don't know if any of this code would work because I've tried adding braces and still can't compile it.**/
    class Hand()
    static int r = 1;
    public Hand() { CardDeck.rounds = r; }
    public int getRounds() { return r++; }
    final class Card
    public static final int ACE = 1;
    public static final int JACK = 11;
    public static final int QUEEN = 12;
    public static final int KING = 13;
    public static final int CLUBS = 1;
    public static final int DIAMONDS = 2;
    public static final int HEARTS = 3;
    public static final int SPADES = 4;
    public Card(int v, int s)
    value = v;
    suit = s;
    public int getValue() { return value; }
    public int getSuit() { return suit;  }
    public int rank()
    if (value == 1)
    return 4 * 13 + suit;
    else
    return 4 * (value - 1) + suit;
    /**This works, but I'm confused. How is this method called? Does it call itself?**/
    public String toString()
    String v;
    String s;
    if (value == ACE)
    v = "Ace";
    else if (value == JACK)
    v = "Jack";
    else if (value == QUEEN)
    v = "Queen";
    else if (value == KING)
    v = "King";
    else
    v = String.valueOf(value);
    if (suit == DIAMONDS)
    s = "Diamonds";
    else if (suit == HEARTS)
    s = "Hearts";
    else if (suit == SPADES)
    s = "Spades";
    else
    s = "Clubs";
    return v + " of " + s;
    private int value; //Value is an integer, so how can a
    private int suit; //string be assigned to an integer?
    }

    Thank you so much for offering to help me with this Jamie! When I tried to call change value using:
    Card dealer = (d.changeValue());
    I get an error message saying:
    Incompatible types found: int
    required: Card
    I had my weekly class last night and the professor cleared up a few things for me, but I've not had time to make all of the necessary changes. I did find out how toString worked, so that's one question out of the way, and he gave us a lot of information for adding another class to generate random numbers.
    Again, thank you so much. I really want to learn this but I'm feeling so stupid right now. Any help you can give me about the above error message would be appreciated.

  • New and need help with keithley 2700 GPIB threw labview 2010

    Hello everyone,
    I have the drivers for the keithley 2700 dmm and its ok with labview idntifying the device.
    but when im trying to run the "Keithley 27XX Single Measurement.vi" and take a single resistance measurment
    I always get this error, (pic related)
    can anyone help please?
    btw, where can i start learn from zero how to program in labview in GPIB protocol (not visa) ?
    thanks alot.
    E.
    Attachments:
    Error.jpg ‏500 KB

    Zerez,
    Definately search the forums as I found another forum wher they tried troubleshooting a 2700 that was locking up. Unfortunately a resolution wasn't determined. 
    http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/keithley-2700-7700-4-wire-Measurement-GPIB/td...
    Can you use max to request values from the device? Using visa test panels. It should reply to the identification command if it is functioning properly.
    Kyle Hartley
    RIO Product Support Engineer
    National Instruments

  • New and need help with replace harddrive M45-s265

    Hello,
    I am not sure were to post this had a hard time trying to find were to post this message.
    (I also upgraded to 2g memory with out a problem)
    I replaced the board and get a message as if it has none 
    part of message
    PXE-E61: Media test failure, check cable
    PXE-MOF: Exiting PXE ROM
    The new board is from newegg and is a western digital wd scorpio ATA 250 gb wd2500beve-00wzto, I was told this is what i needed. 
    The key in and pins are the same as old board.
    Thank you so much for any help I can get

    That's the correct drive.  What is your question?  To do the replacement, you flip the unit over, remove the hard drive cover, slip the drive out, remove the 'caddy' and put it on the new drive, slide the new drive back in, replace the cover and boot from your recovery disks to restore the original disk image.

  • I am really new and need help with internet

    Hi. I am really excited about the new MACS and want one really bad. First, I need to know what I would need to get for wireless internet. Next, are Macs compatible for Internet like MSN?
    iBookG4   Windows XP   I want to get an iBookG4

    I have a PowerBook G4 17 with a gig of ram that I absolutely couldn't live without. I use a Verizon aircard for internet access, and it's proven to be about 90% as fast as a high speed cable connection. I routinely send pics up to 3M in size with no problem. The only thing I have found that it really doesn't do very well is downloading software. And the Verizon card is really affordable--I have an unlimited plan that doesn't hurt each month at all. Hope this helps.

  • New and need help with $ value in a sell

    I just bump into this product and h
    ave fall in love with. how do I format
    starting pay field to $0.00 in
    the numeric field instead of just 18
    any free tutuorial is appreciated

    Set the display pattern for the Date/ Time Field to "date{MM/YY}" to display like 08/10..
    Thanks
    Srini

  • I'm new and need help with lists.

    I'm writing an app in java (duh, thats why im here), and using NetBeans. I need to know how to add items to an awt list at run time. Thanks for your help in advance. ;)

    Try the APIs. I am assuming that you are not using the GUI editing part of NetBeans to make your app, but if you are, again.... make the action and then look at the APIs .
    Good Luck,
    Edward S. Rice

  • Hi - new and need help with christmas pressie plea...

    Hi
    I was given the BT Graphite 2500 answering machine phone with 2 extra handsets.
    I have charged them all up and put them in situ today. I have got the caller display facility, and when i test the phone with my mobile, only the base unit (with the answer phone) rings.  The other two handsets show who is calling, but neither of the handsets ring.  What should i do?
    Thanks

    All i can suggest is recheck the user guide and after that call the help line If you experience any problems, please call the Helpline on Freephone 0808 100 6556 tomorrow because of the christmas holiday period
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

  • My e-mail messages are disappearing from my inbox after only three days and I don't know where they are going or how to retrieve them and need help with this!

    THe messages are not in my archives and I don't delete them as soon as I get them. Where in the world are they going? I needed a number of them in order to make appropriate responses, and they are no longer in my inbox!

    do you get your mail on another device which might be deleting them after 3 days. A phone perhaps.

  • I just downloaded an album from itunes and 2 of the tracks will not play at all, they cut off. I need help with this??

    I just downloaded an album from itunes and 2 of the tracks will not play at all, they cut off. I need help with this??

    Does the track play correctly in Quicktime Player?  If it does then it is an iTunes issue.  If it doesn't then it is possible the file was not completely downloaded, or is corrupt.
    Downloading (using iOS or computer) past purchases from the App Store, iBookstore, and iTunes Store - http://support.apple.com/kb/ht2519 - enabled with iTunes 10.3 and newer; not available in all countries; apps, books (not audiobooks), music, t.v. shows, and movies (some - not all studios have permitted this). Movies currently available in the USA only. Downloading previously purchased movies and TV shows requires iTunes 10.6 or later.  Discontinued items not available. For items not included in the iCloud list (e.g., ringtones), or locations or computer systems where iCloud is not (yet?) available, you only get one download per fee paid. 
    If it can be downloaded again, delete the track from iTunes.
    Select the store on the left side of iTunes.
    Click on Purchased on the right side under Quick Links.
    You can re-download your available previous purchases.
    If it is corrupt and you cannot download it a second time, contact Apple.  Contact iTunes Store support staff through the report a problem links in your account history or,
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html > Get iTunes support via Express Lane > iTunes > iTunes Store

  • I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in

    I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?

    For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
    For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
    See: 
    http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html  
    Be well...

  • I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio

    I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?

    For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
    For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
    See: 
    http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html  
    Be well...

  • Urgently need help with this

    Hi!!
    I urgently need help with this:
    When I compile this in Flex Builder 3 it says: The element type 'mx:Application' must be terminated by the matching end-tag '</mx:Application>'.
    but I have this end tag in my file, but when I try to switch from source view to desgin view it says, that: >/mx:Script> expected to terminate element at line 71, this is right at the end of the .mxml file. I have actionscript(.as) file for scripting data.
    This is the mxml code to terminate apllication tag which I did as you can see:
    MXML code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#007200, #000200]" width="1024" height="768" applicationComplete="popolni_vse()">
    <mx:HTTPService id="bazaMME" url="lokalnabaza/baza_MME_svn.xml" showBusyCursor="true" resultFormat="e4x"/>
    <mx:Script source="dajzaj.as"/>
    <mx:states>
    <mx:State name="Galerije">
        <mx:SetProperty target="{panel1}" name="title" value="Galerije MME"/>
        <mx:SetProperty target="{panel2}" name="title" value="opis slik"/>
        <mx:SetProperty target="{panel3}" name="title" value="Opis Galerije"/>   
        <mx:AddChild relativeTo="{panel1}" position="lastChild">
        <mx:HorizontalList x="0" y="22" width="713.09863" height="157.39436" id="ListaslikGalerije"></mx:HorizontalList>
                </mx:AddChild>
                <mx:SetProperty target="{text1}" name="text" value="MME opisi galerij "/>
                <mx:AddChild relativeTo="{panel1}" position="lastChild">
                    <mx:Label x="217" y="346" text="labela za test" id="izbr"/>
                </mx:AddChild>
                <mx:SetProperty target="{label1}" name="text" value="26. November 2009@08:06"/>
                <mx:SetProperty target="{label1}" name="x" value="845"/>
                <mx:SetProperty target="{label1}" name="width" value="169"/>
                <mx:SetProperty target="{Gale}" name="text" value="plac za Galerije"/>
            </mx:State>
            <mx:State name="Projekti"/>
        </mx:states>
    <mx:MenuBar id="MMEMenu" labelField="@label" showRoot="true" fillAlphas="[1.0, 1.0]" fillColors="[#043D01, #000000]" color="#9EE499" x="8" y="24"
             itemClick="dajVsebino(event)" width="1006.1268" height="21.90141">
           <mx:XMLList id="MMEmenuModel">
                 <menuitem label="O nas">
                     <menuitem label="reference podjetja" name="refMME" type="check" groupName="one"/>
                     <menuitem label="reference direktor" name="refdir" type="check" groupName="one"/>
                  <menuitem label="Kontakt" name="podatMME" groupName="one" />
                  <menuitem label="Kje smo" name="lokaMME" type="check" groupName="one" />
                 </menuitem>           
                 <menuitem type="separator"/>
                 <menuitem label="Galerija">
                     <menuitem label="Slovenija" name="galSvn" type="check" groupName="one"/>
                     <menuitem label="Nemčija" name="galDeu" type="check" groupName="one" />
                 </menuitem>
                 <menuitem type="separator"/>
                 <menuitem label="projekti">
                     <menuitem label="Slovenija" name="projSvn" type="check" groupName="one"/>
                     <menuitem label="Nemčija" name="projDeu" type="check" groupName="one" />
                     <menuitem label="Madžarska" name="projHun" type="check" groupName="one"/>
                 </menuitem>
             </mx:XMLList>                       
             </mx:MenuBar>
        <mx:Label x="845" y="10" text="25. November 2009@08:21" color="#FFFFFF" width="169" height="18.02817" id="label1"/>
        <mx:Label x="746" y="10" text="zadnja posodobitev:" color="#FFFFFF"/>
        <mx:Panel x="9" y="57" width="743.02814" height="688.4507" layout="absolute" title="Plac za Vsebino" id="panel1">
            <mx:Text x="0" y="-0.1" text="MME vsebina" width="722.95776" height="648.4507" id="Gale"/>
        </mx:Panel>
        <mx:Label x="197.25" y="748.45" color="#FFFFFF" text="Copyright © 2009 MME d.o.o." fontSize="12" width="228.73239" height="20"/>
        <mx:Label x="463.35" y="748.45" text="izdelava spletnih strani: FACTUM d.o.o." color="#FBFDFD" fontSize="12" width="287.60565" height="20"/>
        <mx:Panel x="759" y="53" width="250" height="705.07043" layout="absolute" title="Plac za hitre novice" id="panel3">
            <mx:Text x="0" y="0" text="MME novice" width="230" height="665.07043" id="text1"/>
            <mx:Panel x="-10" y="325.35" width="250" height="336.61972" layout="absolute" title="začasna panela" color="#000203" themeColor="#4BA247" cornerRadius="10" backgroundColor="#4B9539" id="panel2">
                <mx:Label x="145" y="53" text="vrednost" id="spremmen"/>
                <mx:Label x="125" y="78" text="Label"/>
                <mx:Label x="125" y="103" text="Label"/>
                <mx:Label x="0" y="53" text="spremenljivka iz Menuja:"/>
                <mx:Label x="45" y="78" text="Label"/>
                <mx:Label x="45" y="103" text="Label"/>
            </mx:Panel>
        </mx:Panel>
        <mx:Label x="9.9" y="10" text="plac za naslov MME vsebine" id="MMEnaslov" color="#040000"/>
         </mx:states></mx:Application>

    I know it's been a while but… did you fix this?
    It looks to me like you are terminating the <mx:Application> tag at the top. The opening tag should end like this: resultFormat="e4x">, not resultFormat="e4x"/> (Remove the /).
    Carlos

  • Please help! I am trying to change my Apple Id that used to be my mother to Mine- Every time i have it changed and i go and try and do an update it continues to ask for her old password. I really need help with this!

    Please help! I am trying to change my Apple Id that used to be my mother to Mine- Every time i have it changed and i go and try and do an update it continues to ask for her old password. I really need help with this!

    Phil0124 wrote:
    Apps downloaded with an Apple ID are forever tied to that Apple ID and will always require it to update.
    The only way around this is to delete the apps that require the other Apple ID and download them again with yours.
    Or simply log out of iTunes & App stores then log in with updated AppleID.

  • I need help with this script please ASAP

    So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
    The script (Sorry if it's a bit long):
    #------------Startup-------------
    display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
    set Lolz to (button returned of the result)
    if Lolz is "Cyaaaa" then
    killapp()
    else if Lolz is "Take the Quiz" then
              do shell script "say -v samantha Ok starting in 3…2…1…GO!"
    #------------Question 1-----------
              display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
              set A1 to (button returned of the result)
              if A1 is "Apprentices" then
                        do shell script "say -v samantha Correct Answer"
              else
                        do shell script "say -v samantha Wrong Answer"
      #----------Question 2--------
                        display dialog "Most children were taught
    to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
                        set A2 to (button returned of the result)
                        if A2 is "Bible" then
                                  do shell script "say -v samantha Correct Answer"
                        else
                                  do shell script "say -v samantha Wrong Answer"
      #------------Question 3---------
                                  display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
                                  set A3 to (button returned of the result)
                                  if A3 is "Great Awakening" then
                                            do shell script "say -v samantha Correct Answer"
                                  else
                                            do shell script "say -v samantha Wrong Answer"
      #-----------Question 4--------
                                            display dialog "_______ was
    a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
                                            set A4 to (button returned of the result)
                                            if A4 is "Ben Franklin" then
                                                      do shell script "say -v samantha Correct Answer"
                                            else
                                                      do shell script "say -v samantha Wrong Answer"
      #----------Question 5-------
                                                      display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
                                                      set A5 to (button returned of the result)
                                                      if A5 is "Land" then
                                                                do shell script "say -v samantha Correct Answer"
                                                      else
                                                                do shell script "say -v samantha Wrong Answer"
      #---------Question 6--------
                                                                display dialog "The first step toward guaranteeing these rights came in 1215. That
    year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
                                                                set A6 to (button returned of the result)
                                                                if A6 is "Magna Carta" then
                                                                          do shell script "say -v samantha Correct Answer"
                                                                else
                                                                          do shell script "say -v samantha Wrong Answer"
      #----------Question 7--------
                                                                          display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
                                                                          set A7 to (button returned of the result)
                                                                          if A7 is "Parliament" then
                                                                                    do shell script "say -v samantha Correct Answer"
                                                                          else
                                                                                    do shell script "say -v samantha Wrong Answer"
      #--------Question 8-----
                                                                                    display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
                                                                                    set A8 to (button returned of the result)
                                                                                    if A8 is "King James II" then
                                                                                              do shell script "say -v samantha Correct Answer"
                                                                                    else
                                                                                              do shell script "say -v samantha Wrong Answer"
      #--------Question 9------
                                                                                              display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
                                                                                              set A9 to (button returned of the result)
                                                                                              if A9 is "William/Mary/Glorius Revolution" then
                                                                                                        do shell script "say -v samantha Correct Answer"
                                                                                              else
                                                                                                        do shell script "say -v samantha Wrong Answer"
      #---------Question 10-----
                                                                                                        display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
                                                                                                        set A10 to (button returned of the result)
                                                                                                        if A10 is "Rights" then
                                                                                                                  do shell script "say -v samantha Correct Answer"
                                                                                                        else
                                                                                                                  do shell script "say -v samantha Wrong Answer"
      #---------Question 11------
                                                                                                                  display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
                                                                                                                  set A11 to (button returned of the result)
                                                                                                                  if A11 is "Ohio" then
                                                                                                                            do shell script "say -v samantha Correct Answer"
                                                                                                                  else
                                                                                                                            do shell script "say -v samantha Wrong Answer"
      #------Question 12---------
                                                                                                                            display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
                                                                                                                            set A12 to (button returned of the result)
                                                                                                                            if A12 is "George Washington" then
                                                                                                                                      do shell script "say -v samantha Correct Answer"
                                                                                                                            else
                                                                                                                                      do shell script "say -v samantha Wrong Answer"
      #---------Question 13-------
                                                                                                                                      display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
                                                                                                                                      set A13 to (button returned of the result)
                                                                                                                                      if A13 is "Ben Franklin" then
                                                                                                                                                do shell script "say -v samantha Correct Answer"
                                                                                                                                      else
                                                                                                                                                do shell script "say -v samantha Wrong Answer"
      #--------Question 14------
                                                                                                                                                display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
                                                                                                                                                set A14 to (button returned of the result)
                                                                                                                                                if A14 is "" then
                                                                                                                                                          do shell script "say -v samantha Correct Answer"
                                                                                                                                                else
                                                                                                                                                          do shell script "say -v samantha Wrong Answer"
      #-------Question 15-------
                                                                                                                                                          display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
                                                                                                                                                          set A15 to (button returned of the result)
                                                                                                                                                          if A15 is "Command an attack against French" then
                                                                                                                                                                    do shell script "say -v samantha Correct Answer"
                                                                                                                                                          else
                                                                                                                                                                    do shell script "say -v samantha Wrong Answer"
      #------TheLolQuestion-----
                                                                                                                                                                    display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
                                                                                                                                                                    set LOOL to (button returned of the result)
                                                                                                                                                                    if LOOL is "Mr.White" then
                                                                                                                                                                              do shell script "say -v samantha Congratulations…you…have…common…sense"
                                                                                                                                                                    else
                                                                                                                                                                              do shell script "say -v alex Do…you…have…eyes?"
                                                                                                                                                                              #------END------
                                                                                                                                                                              display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
                                                                                                                                                                              set endmenu to (button returned of the result)
                                                                                                                                                                              if endmenu is "I did!" then
                                                                                                                                                                                        do shell script "say -v samantha Your awesome"
                                                                                                                                                                              else
                                                                                                                                                                                        do shell script "say -v alex Go outside and run a lap"
                                                                                                                                                                              end if
                                                                                                                                                                    end if
                                                                                                                                                          end if
                                                                                                                                                end if
                                                                                                                                      end if
                                                                                                                            end if
                                                                                                                  end if
                                                                                                        end if
                                                                                              end if
                                                                                    end if
                                                                          end if
                                                                end if
                                                      end if
                                            end if
                                  end if
                        end if
              end if
    end if

    Use code such as:
    display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
    set A1 to (button returned of the result)
    if A1 is "Apprentices" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    #----------Question 2--------
    display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
    set A2 to (button returned of the result)
    if A2 is "Bible" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    (90444)

Maybe you are looking for