Your SlideShare is downloading. ×
0
Having a Bath Every task that you do can be broken down into main steps.  Those steps can often be broken down into smalle...
Program Design Before you can write a successful program you will first need to think about what you have been asked to do...
<ul><li>Design - Algorithm </li></ul><ul><li>Main Steps </li></ul><ul><li>Get numbers </li></ul><ul><li>Calculate answer <...
Problem You need to write a program which will ask the user what the answer to two numbers multiplied together is.  The pr...
Upcoming SlideShare
Loading in...5
×

Prog Design

270

Published on

Programming Design

Published in: Education, Travel, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
270
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Prog Design"

  1. 1. Having a Bath Every task that you do can be broken down into main steps. Those steps can often be broken down into smaller steps. This is sometimes called Stepwise Refinement or writing an Algorithm. So a task like having a bath can be broken down into the main things you have to do. Each of those main things can be further broken down into smaller, more detailed steps. Each of these steps will form instructions for performing the task. <ul><li>Main Steps </li></ul><ul><li>Run the bath </li></ul><ul><li>Have a bath </li></ul><ul><li>Dry off </li></ul>Refinements 1.1 Run the hot and cold water 1.2 Add bubble bath 1.3 Check the temperature 1.4 Turn off water 2.1 Get in bath 2.2 Wash yourself 2.3 Pull the plug out 3.1 Get out of bath 3.2 Use towel to dry yourself 3.3 Get dressed
  2. 2. Program Design Before you can write a successful program you will first need to think about what you have been asked to do and how you are going to do it. Analysis This is where you think about what you have been asked to do. You need to write down what the task is in your own words, and how you hope to solve the problem. Design This is where you need to think about how you are going to solve the problem. You need to break the problem down into the main steps to solve it. Then you need to see if you can break the main steps down into smaller steps. The smaller steps are called refinements.
  3. 3. <ul><li>Design - Algorithm </li></ul><ul><li>Main Steps </li></ul><ul><li>Get numbers </li></ul><ul><li>Calculate answer </li></ul><ul><li>Display answer </li></ul><ul><li>Refinements </li></ul><ul><li>1.1 Get first number </li></ul><ul><li>1.2 Get second number </li></ul><ul><li>2.1 Answer = first number + second number </li></ul><ul><li>3.1 Display answer on the screen </li></ul>Analysis “ I have been asked to write a program which will ask the user for two numbers, add them together and display the answer”. Problem You need to write a program which will calculate the sum of two numbers. You should ask the user to enter two numbers. The program should then work out the answer and then display the answer on the screen like this: number1 + number2 = answer e.g. 3 + 4 =7
  4. 4. Problem You need to write a program which will ask the user what the answer to two numbers multiplied together is. The program should take in their answer and check if it is right. The program should display a message saying “Well done, Right answer!” If they got it right. It should say “Sorry, the answer is…” if they got it wrong. <ul><li>Design - Algorithm </li></ul><ul><li>Main Steps </li></ul><ul><li>Get answer </li></ul><ul><li>Check answer </li></ul><ul><li>Display message </li></ul><ul><li>Refinements </li></ul><ul><li>1.1 Ask question </li></ul><ul><li>1.2 Get answer </li></ul><ul><li>2.1 If answer is right then </li></ul><ul><li>2.2 message = “Well done, Right Answer!” </li></ul><ul><li>2.3 If answer is wrong then </li></ul><ul><li>2.4 message = “Sorry, the right answer is 72” </li></ul><ul><li>3.1 Display message </li></ul>Analysis “ I have been asked to write a program which will ask the user what the answer to 8 * 9 is. The program should read in their answer, check if it is right and display a message saying either “Well done” or displaying the correct answer. ”.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×