Use the five step process to design a pseudocode algorithm for the following scenarios:
Create a flow chart for each algorithm.
Publish your work to your assignment document.
Scenario 1
A graphic artist needs to be able to provide quotes for creating business cards for clients.Business cards have an initial artwork setup cost and a cost per card. She needs to be able to enter the initial artwork setup cost,the cost per card,and the number of cards required.The program should then calculate the quote and display the result on the screen.
Problem
To provide quotes for clients business cards
Inputs
Initial artwork setup cost
Cost per card
Number of cards required
Outputs
The Quote
Processing
Get the initial artwork setup cost
Get the cost per card
Get the number of cards required
Add the initial artwork setup cost to the cost per card and multiply this figure by the number of cards required
Algorithm
Calculate the quote
Prompt the user for the initial artwork setup cost
Get the initial artwork setup cost
Validate the initial artwork setup cost
Prompt the user for the cost per card
Get the cost per card
Validate the cost per card
Prompt the user for the number of cards required
Get the number of cards required
Validate the number of cards required
Initial artwork setup cost + cost per card x number of cards required
Display the quote
Close Display
End
Scenario 2
A project manager needs to be able to to estimate how many weeks it will take to complete a project.She needs to be able to enter the number of project team members,the number of hours in a working week and the estimated number of hours it will take to complete the project. The program should then calculate the number of weeks it will take to complete the project.The number of weeks should then be displayed on the screen.
Problem
To find out how many weeks it will take to complete a project
Inputs
Number of project team members
Number of hours in a working week
Estimated number of hours it will take to complete the project
Outputs
The number of weeks it will take to complete the project
Processing
Get the number of project team members
Get the number of hours in a working week
Get the estimated number of hours it will take to complete the project
Multiply the number of team projects members by the number of hours in a working week,divide this figure by the estimated number of hours it will take to complete the project
Algorithm
Calculate the weeks
Prompt the user for the number of project team members
Get the number of project team members
Validate the number of project team members
Prompt the user for the number of hours in a working week
Get the number of hours in a working week
Validate the number of hours in a working week
Prompt the user for the estimated number of hours it will take to complete the project
Get the estimated number of hours it will take to complete the project
Validate the estimated number of hours it will take to complete the project
Number of project team members x number of hours in a working week / estimated number of hours it will take to complete the project
Display the number of weeks
Close Display
End
Monday, April 19, 2010
Learning & Assessment Activity 1.7
View the code for each button and note of any differences you can see in the algorithm. We will discuss these differences as we continue.
Publish the differences in each algorithm to your assessment document.
Public Class Form1
Private Sub btnEnds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnds.Click
Dim intCount = 0
Do While intCount <= 1
MsgBox("This is a repeating message box with an end")
intCount += 1
Loop
End Sub
Private Sub btnNeverEnds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNeverEnds.Click
Dim intCount = 0
Do While intCount <= 1
MsgBox("This is a repeating message box that never ends (you will need to click the stop button to end)")
Loop
End Sub
End Class
The difference between the two algorithms as you can see above is that with the button that says end,the message actually does end whereas with the button named never ends,the message never ends.Basically the later message is looping,it is constantly continuing.
Publish the differences in each algorithm to your assessment document.
Public Class Form1
Private Sub btnEnds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnds.Click
Dim intCount = 0
Do While intCount <= 1
MsgBox("This is a repeating message box with an end")
intCount += 1
Loop
End Sub
Private Sub btnNeverEnds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNeverEnds.Click
Dim intCount = 0
Do While intCount <= 1
MsgBox("This is a repeating message box that never ends (you will need to click the stop button to end)")
Loop
End Sub
End Class
The difference between the two algorithms as you can see above is that with the button that says end,the message actually does end whereas with the button named never ends,the message never ends.Basically the later message is looping,it is constantly continuing.
Learning & Assessment Activity 1.6
Locate and unzip the file named LA_1.6.zip
Run the program and click the Ends button. You will be presented with a MsgBox
(message box), click OK on each box until the program finishes.
Run the program and click the Never Ends button. This time you can click the OK
button as many times as you like, but the program will not stop.
You get a button in which the message ends and one in which it never does until you stop the debugging process
Run the program and click the Ends button. You will be presented with a MsgBox
(message box), click OK on each box until the program finishes.
Run the program and click the Never Ends button. This time you can click the OK
button as many times as you like, but the program will not stop.
You get a button in which the message ends and one in which it never does until you stop the debugging process
Learning & Assessment Activity 1.5
Describe how the algorithms you developed in 1.1 and 1.2 end.
Publish your descriptions to your assessment document.
To indicate that the program has ended it requires the display to close.
The algorithm must end in an approriate manner. In my algortithms below you can see that after the result has been desplayed i have put display close,this is so that the user is not left with the results on the screen.
Calculate the cost of the parcel
Prompt the user for the parcel weight
Get the parcel weight
Validate parcel weight
Prompt the user for the standard charge
Get the standard charge
Validate standard charge
Parcel weight x Standard charge
Display the cost of the parcel
Close Display
End
Calculate the hours
Prompt the user for the number of levels
Get the number of levels
Validate number of levels
Prompt the user for the past performance
Get the past performance
Validate past performance
Number of levels x Past performance
Display the number of hours that it will take to finish all of the levels
Close Display
End
Publish your descriptions to your assessment document.
To indicate that the program has ended it requires the display to close.
The algorithm must end in an approriate manner. In my algortithms below you can see that after the result has been desplayed i have put display close,this is so that the user is not left with the results on the screen.
Calculate the cost of the parcel
Prompt the user for the parcel weight
Get the parcel weight
Validate parcel weight
Prompt the user for the standard charge
Get the standard charge
Validate standard charge
Parcel weight x Standard charge
Display the cost of the parcel
Close Display
End
Calculate the hours
Prompt the user for the number of levels
Get the number of levels
Validate number of levels
Prompt the user for the past performance
Get the past performance
Validate past performance
Number of levels x Past performance
Display the number of hours that it will take to finish all of the levels
Close Display
End
Learning & Assessment Activity 1.4
Refine the pseudocode algorithm you created in activity 1.2 to take into account all possible situations.
Publish your refined algorithm to your assessment document.
Calculate the hours
Prompt the user for the number of levels
Get the number of levels
Validate number of levels
Prompt the user for the past performance
Get the past performance
Validate past performance
Number of levels x Past performance
Display the number of hours that it will take to finish all of the levels
End
Publish your refined algorithm to your assessment document.
Calculate the hours
Prompt the user for the number of levels
Get the number of levels
Validate number of levels
Prompt the user for the past performance
Get the past performance
Validate past performance
Number of levels x Past performance
Display the number of hours that it will take to finish all of the levels
End
Learning & Assessment Activity 1.3B
Refine the pseudocode algorithm you created in activity 1.1 to take into account all possible situations.
Publish your refined algorithm to your assessment document.
Calculate the cost of the parcel
Prompt the user for the parcel weight
Get the parcel weight
Validate parcel weight
Prompt the user for the standard charge
Get the standard charge
Validate standard charge
Parcel weight x Standard charge
Display the cost of the parcel
End
Publish your refined algorithm to your assessment document.
Calculate the cost of the parcel
Prompt the user for the parcel weight
Get the parcel weight
Validate parcel weight
Prompt the user for the standard charge
Get the standard charge
Validate standard charge
Parcel weight x Standard charge
Display the cost of the parcel
End
Learning & Assessment Activity 1.3A
Create a flow chart for each of the algorithms you created in activities 1.1 and 1.2.
Publish both of the flow charts to your assessment document.
Publish both of the flow charts to your assessment document.
Sunday, April 18, 2010
Learning & Assessment Activity 1.2
Using the five step process, develop an algorithm for the following problem:
You want to estimate the number of hours it will take you to complete all of the levels in a new video game based on your past performance with other games.
Publish your findings and the resulting algorithm from the five-step process to your
assessment document.
Step One: Define the problem
Find out how long it will take you to finish all of the levels in a new video game
Step Two: Define the inputs
The number of levels
Past performance
Step Three: Define the outputs
The number of hours it will take to complete all of the levels
Step Four: Define processing
Get the number of levels
Get the past performance
Multiply the number of levels by the past performance
Step Five: Develop the algorithm
Calculate the hours
Prompt the user for the number of levels
Get the number of levels
Prompt the user for the past performance
Get the past performance
Number of levels x Past performance
Display the number of hours that it will take to finish all of the levels
End
You want to estimate the number of hours it will take you to complete all of the levels in a new video game based on your past performance with other games.
Publish your findings and the resulting algorithm from the five-step process to your
assessment document.
Step One: Define the problem
Find out how long it will take you to finish all of the levels in a new video game
Step Two: Define the inputs
The number of levels
Past performance
Step Three: Define the outputs
The number of hours it will take to complete all of the levels
Step Four: Define processing
Get the number of levels
Get the past performance
Multiply the number of levels by the past performance
Step Five: Develop the algorithm
Calculate the hours
Prompt the user for the number of levels
Get the number of levels
Prompt the user for the past performance
Get the past performance
Number of levels x Past performance
Display the number of hours that it will take to finish all of the levels
End
Learning & Assessment Activity 1.1
Using the five step process, develop an algorithm for the following problem:
You need to know the cost of sending a parcel to someone.the price of sending the item will depend upon its weight. The postal service has a standard charge per kilo of item weight.
Publish your findings and the resulting algorithm from the five-step process to your
assessment document.
Step One: Define the problem
Find out the parcels weight and the standard postal service charge in order to find out what the cost is to send the parcel.
Step Two: Define the inputs
The parcels weight
The postal service charge
Step Three: Define the outputs
The cost of the parcel
Step Four: Define processing
Get the parcels weight
Get the standard charge
Multiply the parcels weight by the standard charge
Step Five: Develop the algorithm
Calculate the cost of the parcel
Prompt the user for the parcel weight
Get the parcel weight
Prompt the user for the standard charge
Get the standard charge
Parcel weight x Standard charge
Display the cost of the parcel
End
You need to know the cost of sending a parcel to someone.the price of sending the item will depend upon its weight. The postal service has a standard charge per kilo of item weight.
Publish your findings and the resulting algorithm from the five-step process to your
assessment document.
Step One: Define the problem
Find out the parcels weight and the standard postal service charge in order to find out what the cost is to send the parcel.
Step Two: Define the inputs
The parcels weight
The postal service charge
Step Three: Define the outputs
The cost of the parcel
Step Four: Define processing
Get the parcels weight
Get the standard charge
Multiply the parcels weight by the standard charge
Step Five: Develop the algorithm
Calculate the cost of the parcel
Prompt the user for the parcel weight
Get the parcel weight
Prompt the user for the standard charge
Get the standard charge
Parcel weight x Standard charge
Display the cost of the parcel
End
Subscribe to:
Posts (Atom)