Presentation is loading. Please wait.

Presentation is loading. Please wait.

Continue on the Valentines program

Similar presentations


Presentation on theme: "Continue on the Valentines program"— Presentation transcript:

1 Continue on the Valentines program
Computer Science 2 Arrays of Records A couple dry runs A Fix it and Continue on the Valentines program

2 Dry run the following Use the following for input:
program DryRunrecArray; type rectype = record x, y:integer; end; arrayRectype = array[1..10] of rectype; var count, show, total:integer; nums:arrayRectype; temp:rectype; begin count:= 0; total:=0; writeln('Enter value, -1 to quit'); readln(temp.x); while(temp.x <> -1) and (count < 10) do inc(count); writeln('Enter the other value'); readln(temp.y); nums[count] := temp; for show:= 1 to count do writeln(nums[show].x:10,nums[show]. y:10); total:= total + nums[show].x; writeln(total:10); end. Dry run the following Use the following for input: 10, 20, 10, 30, 8, 2, 15, 4, -1

3 Array of Records Dry Run
program arrReRun2_4_11; type rectype = record name:String; num:integer; end; atype = array[1..3] of rectype; var nums:atype; x:integer; y:string; begin y := 'Well '; for x:= 1 to 3 do nums[x].num:= x*10; nums[x].name := y; y:= y + 'Howdy '; writeln(nums[x].name, nums[x].num); end. Array of Records Dry Run

4 This file is on the class website.
program FicksAhRay; //Input 5 names and scores type //Show the above average people rectype = record; name:String; score:integer; atype = array[1..3] of nametype; var person: record; people : array of record; totage, average:real; count:integer; begin for count:= 1 to 5 do writeln('Please enter a name'); readln(name); writeln('Please enter a score'); readln(score); totage := totage + score; average:= total + 1; for count := 1 to 5 do writeln(Above Average People) end; Fix the following This file is on the class website. ArrayRecFix.pas

5 Program Get 5 Names, schools, type of Valentines cards, costs, types of candy. Show all the information in a chart. After the First Part is complete, make the following modifications. Let the user enter a name and the program will return the type of candy. (Tell them if the person is not in the book) Modify this to be set up as a menu. Let the user enter the name of the school, and it will show all of the students from that school. Write the code to find the total of all of the sales. Pushes: Improve user friendliness of the program. Calculate how many of each candy you will need to order. Let it support holding an unknown number of records (but less than 100) Write the program using procedures.


Download ppt "Continue on the Valentines program"

Similar presentations


Ads by Google