WEEK 4 SWAPPING VALUES / CONVERTING VALUES
18th to 24th October
WHAT I HAD TO DO:
We had to create a program that would read the users input, process it and display the results.
HOW I CREATED THE PROGRAM:
For this tutorial I used lblrpompt, txttemperature, cmdctof, cmdftoc, and cmdexit. I also used lblresult for the calculated answer, which for an input of 0 degress Centigrade, was of the form: “That is 32 degrees Fahrenheit”.
Cmfctof calculated a conversion into farhenheit and cmdtfoc also calculated a conversion into centigrade. Both cmfctof and cmdftoc performed their calculations and displayed the results in lblresult.
PROBLEMS THAT I FACED WHILST DESIGNING THE PROGRAM:
This was the second programme were given to design using visual basic. The problems that we encountered were:
- How to convert centigrade to Fahrenheit and Fahrenheit to centigrade to give the correct result.
-
Also that when the calculation had been calculated how to display the result in the format of “That is 32”
As a group we overcame these problems by discussing how we should go about manipulating the given formula. Through our discussions we were successful as we managed to solve the code for the conversion of centigrade to Fahrenheit. Making an assumption from our first solution we adapted it to the Fahrenheit to centigrade solution only to find the program running smoothly. We also asked for help from the other members in the class and our tutorial teacher in order for us to overcome all of our problems.
WEEK 5 GUESS YOUR AGE
25th to 31st October
WHAT I HAD TO DO:
Design a program that would interact with the user by guessing the users age.
HOW I CREATED THE PROGRAM:
First of all I designed the form by using a label in order for the computer to display a random number which it would generate through its container along with a message. For example “Are you 18?”
I used five command buttons and they were as follows:
- For the user to say the guess was correct
- For saying the guess was too high
- For saying the guess was too low
- Exit
- Restart
I put option explicit in the general declarations sections and three dimensions integers for the guess, and for two other variables to hold the upper limit of age being considered and the lower limit. I called these three variables guess, upper and lower.
I then created a subroutine called clear values to set lower to 0, upper to 99 and generated a random number in the range of 0 to 99. I thought that the latter number must be stored in guess so I stored it in guess.
I then created another subroutine called show values to display the value of guess in the label, in the correct format.
I have used a select case statement to output different messages depending on the age according to the ranges (i.e 0-15, 16-21, 22-39, 40 and above)
If the guess is too high I have programmed the program in the subroutine for command too high, I have set the upper to one less than the generated number (guess), and the guess has been set to (the integer part) the average of lower and upper.
Also if the guess is too low, the lower has been set to one more than the guess, a new guess will be calculated from the average of upper and lower, and the output in the label.
PROBLEMS I FACED WHILST DESIGNING THE PROGRAM:
This was the third program given to design from the two that I had designed I found this the quite difficult to design. As we could not able the program to generate a random number this was a problem because the main part of the program was not running smoothly. In order to solve this we discussed and tested different ways for the program to generate a random number. Another problem that we encountered was the restart button although the code was given in the tutorial notes I found it was a bit tricky to manipulate the code.
WEEK 6 READING DATES
1st to 7th November
WHAT I HAD TO DO:
I had to be able to convert data from one type to another.
HOW I CREATED THE PROGRAM:
I had to create a program which would read the date through three text boxes. Each text box was used for
Day
Month
Year
I created a command button called show date; by clicking on this button the date entered would then be displayed.
Along with the show values button I also included restart and exit buttons in order to allow the user to enter other dates and also exit the program.
PROBLEMS I FACED WHILST DESIGNING THE PROGRAM:
One of the major problems I encountered whilst designing this program was coding each of the text box for day, month and year, because when I would click the show date button only some of the date would come. So in order to overcome this program as a group we manipulated the appropriate codes from the tutorial notes and played around with them until the program was running successfully.
WEEK 7 REACTION TIMER GAME
8th to 14th November
WHAT I HAD TO:
I had to create a program which was a game with randomly moving images.
HOW I CREATED THE PROGRAM:
I created a simple reaction timer game in which the player had a short time to click on a randomly – placed image before it moved again. I used the following objects to design the program:
- An image holding a photograph of one of the members in my group.
- Timer with an interval of 2000 milliseconds
- A set of 3 radio buttons, with a frame surrounding them called “Level of difficulty”
- A “new score” output box to display the player’s score (based on how many times the player has accurately clicked on the image).
I changed the Form WindowState property to 0-Nomral so that it wouldn’t maximise the size at runtime.
In the Timer subroutine I wrote instructions to:
- Calculate a new top and Left for the target image, using the RND function to generate a random number related to the limits of the Form’s ScaleWidth and ScaleHeight.
- Move the target image to its new position.
PROBLEMS I FACED WHILST DESIGNING THIS PROGRAM:
Firstly the problem that we stumbled upon when designing this program was inserting my picture into the program this happened because it was the wrong type of image so I had to alter the image type. Another problem that we encountered was with the levels of the game. Level 1 was ok and so was level 2 however we had problems with level two because the picture was moving at the same pace as level two so we fixed this by changing the timer interval.
For this assignment I have worked both individually and collectively in a group of four students. As a group we assisted each other in planning, problem solving and the critical analysis and synthesis of ideas for exploring each activity.
Since the tutorials commenced I have undertook to complete a series of tasks during the tutorial sessions on a week by week basis. Personally I feel that I have met my objectives by completing the tasks set successfully due to my excellent attendance and punctuality.
As an individual attending each one of my tutorials on a weekly basis and on time was of major importance, this was so that I would not loose any valuable time on working towards my objectives which was to complete all the tasks on time successfully.
In the future I will apply the same rules to my studies in order to achieve my objectives, because of my excellent attendance and punctuality. Not only that but also my time management will be a major factor, because as a group we made sure that if the task were not completed in class they would be completed before the next tutorial commenced the following week. This is why I have been able to hand in my tasks on time and make sure they are working accurately.