CP12 Programs

Procedure and Subroutine Section

For each of the following programs a written plan must be submitted.

This includes the Form Plan and the

Plan Subroutines word file to plan your subroutines.


IT12 Sorting Program

Using 1 subroutine called "sort", write a program that takes two numbers as input and then places them in ascending order.

/5 marks plan (We will do the plan together at this time)

/5 marks program


Reduce Fractions Program

 Write a program that takes any fraction and then reduces it. You are expected to have a subroutine called reducefractions that passes two ref parameters representing the numerator and denominator

ie 5/10 would be reduced to 1/2

/5 marks plan

/5 marks code


Add Fractions Program

Write a program that takes any two fractions and adds them. You should use 4 subroutines (GetFractions, AddFracetions, DisplayFractions and the ReduceFractions subroutine from the previous assignment).

Do not change the reduce subroutine at all.. It should just copy and paste perfectly.
I expect you to use different variable names from n1,d1 etc... in the subroutines
The answer must be displayed as a mixed number if necessary

Because i am such a nice guy i will supply you with the code for the Calculate Button

Getfractions (ref n1,ref d1,ref n2,ref d2)
Addfractions (n1,d1,n2,d2,ref na,ref da)
Reduce (ref na,ref da)
DisplayFractions(na,da)

/5 marks plan

/10 marks code


Math Tester Program

Write a program that generates a Times Table Test. 10 questions should appear, one question at a time. The user should then input the answer. The program should keep track of the students score.

You must use ref parameters in this program where necessary

You must use the following subroutines

A subroutine that generates the question
A subroutine that compares the entered answer with the real answer
A subroutine that handles the scoring
You may use more subroutines if you consider this to be necessary

/5 marks plan

/10 marks code


Mastermind Program

Write a program that allows you to mimic that game of mastermind. The teacher will explain if you don't know how the game works

Click here to try out a game.

Our game will be expected to work with 5 different colours and have 10 spots to make guesses.

Before we do this program we will learn about control arrays.

We will also refresh out memories on random numbers, and option buttons

/10 marks for the plan- at least 4 subroutines are expected and filled out on the planning sheet

/40 game

/10 visual looks.... user friendlyness...Title screen

/30

/5 generates a secret code that is revealled at end of the game or when the user loses
/5 displays user guesses
/5 user clicks on pegs to change guess colors.(user should only be able to click on the correct turn pegs)
/10 marks user guesses and displays in answers in text boxes
/5 marks user guesses and displays answers as peg