Algorithms, Part 3 of 3Writing Algorithms from ScratchThe BoxDrawing a RectangleCalculate Average Daily SalesCalculate Miles Per GallonCalculate Semester GPACMSC 104, Version 8/06 1L06Algorithms3.pptAlgorithms, Part 3 of 3Topics•In-Class Project: The Box•In-Class Project: Drawing a RectangleReading•NoneCMSC 104, Version 8/06 2L06Algorithms3.pptWriting Algorithms from Scratch•Given a problem statement, we are going to write the corresponding generic algorithm for the solution.•We will use the following procedure:oDetermine the algorithm inputs and outputsoPseudocode a rough algorithmoDetermine the correct calculations needed.oComplete the pseudocodeoVerify the pseudocode produces the correct results.CMSC 104, Version 8/06 3L06Algorithms3.pptThe BoxProblem: Write an interactive program to compute and display the volume and surface area of a box. The program must also display the box dimensions. Error checking should be done to be sure that all box dimensions are greater than zero.CMSC 104, Version 8/06 4L06Algorithms3.pptDrawing a RectangleProblem: Write an interactive program that will draw a solid rectangle of asterisks (*). The program must also display the dimensions of the rectangle. Error checking must be done to be sure that the dimensions are greater than zero.CMSC 104, Version 8/06 5L06Algorithms3.pptCalculate Average Daily Sales•Problem: Write an interactive program that will get the daily sales total for each day of the month, adding them together, and calculate the average daily sales. Error checking must be done to ensure that no negative numbers are entered by the user.CMSC 104, Version 8/06 6L06Algorithms3.pptCalculate Miles Per Gallon•Problem: Write an interactive program that will get the miles driven and gallons of gas used. Calculate the miles per gallon and display it to the user. Error checking must be done to ensure that both values are greater than zero.CMSC 104, Version 8/06 7L06Algorithms3.pptCalculate Semester GPA•Problem: Write an interactive program that will ask the user for the number of courses taken this semester and then get the grades for those course, using A=4, B=3, C=2, D=1, and F=0. Calculate and display the GPA to the user. Error checking must be done to ensure that no negative numbers are entered by the
View Full Document