Friday, October 13, 2006

 

Week of Oct. 16 - Norton textbook, Ch.7


This week we return to the Norton textbook.

We will work on Lesson 7 ("Transforming Data into Information").

The usual files will be waiting for you in the Pickup Folder.

Tuesday, October 10, 2006

 

Solutions to Turing, Chapter 5, #13, 14, 15



% The "Ch05_13" Program
const MISC:= 100
const TICKETCOST := 65
var foodCost, diskJockey, hallRental, decorations, waitingStaff, total: real
put "Enter the cost of food"
get foodCost
put "Enter the cost of the DJ"
get diskJockey
put "Enter the cost of the rental of the hall"
get hallRental
put "Enter the cost of the decorations"
get decorations
put "Enter the cost of the waiting staff"
get waitingStaff
put ""
total:= foodCost + diskJockey + hallRental + decorations + waitingStaff + MISC
put "To break even you must sell ", total/ TICKETCOST," tickets"




% The "Ch05-14" Program
var test1Mark, test2Mark, test3Mark, test4Mark, test5Mark: real
var test1Total, test2Total, test3Total, test4Total, test5Total: real
var test1Average, test2Average, test3Average, test4Average, test5Average :
real
var name: string
put "Please enter your name"
get name
put""
put "Enter the mark for your first test, ", name,":"..
get test1Mark
put "What is the maximum mark value for this test? "..
get test1Total
test1Average := test1Mark / test1Total* 100
put""
put "Enter the mark for your second test", name,":" ..
get test2Mark
put "What is the maximum mark value for this test? "..
get test2Total
test2Average := test2Mark / test2Total* 100
put""
put "Enter the mark for your third test", name,":" ..
get test3Mark
put "What is the maximum mark value for this test? "..
get test3Total
test3Average := test3Mark / test3Total* 100
put""
put "Enter the mark for your fourth test", name,":"..
get test4Mark
put "What is the maximum mark value for this test? " ..
get test4Total
test4Average := test4Mark / test4Total* 100
put""
put "Enter the mark for your fifth test", name,":" ..
get test5Mark
put "What is the maximum mark value for this test? " ..
get test5Total
test5Average := test5Mark / test5Total* 100
put""
put "The average for", test1Mark," /", test1Total," is ", test1Average, " %"
put "The average for", test2Mark," /", test2Total, " is ", test2Average, " %"
put "The average for", test3Mark," /", test3Total," is ", test3Average, " %"
put "The average for", test4Mark, " /", test4Total, " is ", test4Average, " %"
put "The average for", test5Mark," /", test5Total," is ", test5Average," %"
put ""
put "Your overall average ", name,", is ", (test1Mark + test2Mark + test3Mark + test4Mark + test5Mark) / (test1Total + test2Total +
test3Total+ test4Total+ test5Total) * 100," %"



% The "Ch05-15a " Program
/*
Ask the user for a real number which expresses the area of a figure.
Assume that the figure was a circle.
Output the radius and then the circumference of the circle.
*/
var area, circumference, radius: real
const PI:= 3.14159
put "Enter the area of a circle:"..
get area
radius := sqrt (area / PI)
circumference := 2 * radius * PI
put "The radius of the circle is ", radius
put "The circumference of the circle is ", circumference



% The "Ch05-15b" Program
/*
Ask the user for a real number which expresses the area of a figure.
Assume that that the figure was a square.
Output the length and width and then the perimeter of the square.
*/
var area, widthLength, perimeter : real
put "Enter the area of the square "..
get area
widthLength := sqrt (area)
perimeter := widthLength * 2 + widthLength * 2
put "The width and length of the square is ", widthLength
put "The perimeter of the square is ", perimeter

Monday, October 09, 2006

 

Test on Turing, Chapter 5

The upcoming test will cover Turing, Chapter 5 (Variables and Constants). You will, of course, also have to know the basics you learned in Chapter 4, such as field sizes, decimal places, and so on. You will be writing 3-5 Turing programs in class. The questions will be very similar to any of (i) the programs you copied from the book while reading the chapter or (ii) the questions at the end of the chapter.

The day after the test, bring your Norton textbook to class.

Happy Thanksgiving!

This page is powered by Blogger. Isn't yours?