Procedure

  1. Prog 1: Type in the following program
    1. Run it 3 times using different values for the radius.

        SCREEN 9
        INPUT "Radius"; radius CIRCLE (200, 200), radius, 2 ' 2 is color green
        LINE (100, 100)-(100 + radius, 100 + radius), 3, B ' 3 is blue

    2. Describe what happens and why?

    3. Print out program and RUNs.

  2. Prog 2 : Finding Prime Numbers
    1. Enter the following Program

        CLS
        INPUT "Type in an integer number greater than 2 ", N
        LPRINT "Your number is "; N A$ = "YES"
        FOR Test = 2 TO SQR(N)
        IF INT(N / Test) = N / Test THEN A$ = "NO": PRINT "Divisor:"; Test
        NEXT Test
        PRINT "This is a PRIME number?.. "; A$ _

    2. Run the program for a few sample numbers.

    3. Are the following number are PRIME: 1101, 1001, 1111, 123, 321,123 001.

    4. Find three new PRIME numbers greater than 100 000.

                _______________ ___________________ ______________

    5. Print a listing of the program and the run for the following numbers

        2000 and 3001.

  3. Prog 3 : Simulation of Coin Flips
  4. This article is translated to Serbo-Croatian language by Jovana Milutinovich at WebHostingGeeks.com.

    1. Type in the program

        RANDOMIZE TIMER
        INPUT "How many flips"; Num
        PRINT "Number of flips "; Num
        Heads = 0
        FOR Flip = 1 TO Num
        IF RND > .5 THEN Heads = Heads + 1
        NEXT Flip
        PRINT "Percent of Heads = "; Heads / Num * 100; "%"

    2. Run the program and print out each run for 10, 100, 1000, 10 000 flips..

    3. What do you notice about the percentage of Heads?

    4. What is the theoretical % of Heads?  Write out answer on the printouts!!

    5. Change PRINT statement to LPRINT in each line of the program

    6. Analysis of Cion Flipping :

      1. Run the program for 10 000 flips.

      2. Then run the program again for as many HEADS as your last run.

      3. Repeat this process until there are 59 or less HEAD's

    7. A Sample of the runs are given below:

        How many flips? 10 000
        # of Heads = 5060

        How many flips? 5060
        # of Heads = 2549

        How many flips? 2549
        # of Heads = 1257

        How many flips? 1257
        # of Heads = 629

        How many flips? 629
        # of Heads = 298

        How many flips? 298
        # of Heads = 143

    8. After you have run the program, put the data in table form. Illustrated below :

      Trial #

      Num Heads

      1

      10000

      2

      5060

      3

      2549

      4

      1257

      5

      629

      6

      298

      7

      143

    9. Use the CORCO program with this data to determine which mathematical function could generate this data.

    10. You are THE DETECTIVE use CORCO to determine what type of mathematical function best fits the data.    Is it a Straight Line, Exponential, or Power?  

    11. Here is a sample of what your graph in CORCO would look like.

    12. For the best curve fit choose the function with the value of R closest to 1.  Type _________

    13. Print out a graph of the best Corco fit.

    14. Write out the best fit function on the printout and comment on the correlation coefficient!

  5. Prog 4 : Grpahics
    1. Enter the following program

        RANDOMIZE TIMER
        SCREEN 12
        FOR Picture = 1 TO 50
        X = 30 + RND * 550
        Y = 30 + RND * 300
        Radius = RND * 50
        Color1 = RND * 12
        Color2 = RND * 12
        CIRCLE (X, Y), Radius, Color1
        CIRCLE (X, Y), Radius + 1, Color1
        PAINT (X, Y), Color2, Color1
        NEXT Picture

    2. Describe what you see when you run the program 3 different times.

    3. Print out a listing of the program and one of the graphics.

    4. Make the following changes and run the modified program:

        RANDOMIZE TIMER
        SCREEN
        FOR Pic = 1 TO 500
        X = 30 + RND * 550
        Y = 30 + RND * 300
        Radius = RND * 100
        COLOR1 = RND * 12
        COLOR2 = RND * 12
        LINE (X, Y)-(X + Radius, Y + Radius), COLOR1, B
        LINE (X, Y)-(X + Radius + 1, Y + Radius + 1), COLOR1, B
        PAINT (X + 2, Y + 2), COLOR2, COLOR1
        NEXT Pic

    5. Describe what you see when you run the program 3 times.

    6. Print out a listing of the program and one of the graphics.

           Return to CSC 171 Syllabus