Continue on the Array of Records program

Slides:



Advertisements
Similar presentations
Role of variables. Fixed value Description: A variable without any calculation and not changed thereafter; for example we may need to remember the number.
Advertisements

Truth and while Today 15 Minutes online time to finish the random/Swing programs. Truth tables: Ways to organize results of Boolean expressions. Note Taking:
Computer Science 1 How do you store a bunch of similar stuff?
Computer Science I: Understand how to evaluate expressions with DIV and MOD Random Numbers Reading random code Writing random code Odds/evens/…
Computer Science 2 Arrays of Records. First Record Program Input an unknown number of Team Names, School names, and Total scores. (While loop) –Output:
Chapter Topics 11.1 Introduction to Menu-Driven Programs
Program Options: 10 Minutes online
Program options Write a program for one of the following
Computer Science Dynamics.
Computer Science 2 Outline/Learning Objectives for the day:
How do you store a bunch of similar stuff?
Computer Science II First With files.
Computer Science II First With files.
Review Dry Run Taking Names Online time Math is Good
Computer Science 2 Arrays of Records.
Computer Science 1 Get out your notebook
Computer Science 2 Review the Bubble Sort
Insertion Sort Quiz on Thursday.
Computer Science 2 Arrays of Records.
Computer Science And he made a molten sea, ten cubits from the one brim to the other: it was round all about, and his height was five cubits: and.
Computer Science 2 Getting an unknown # of …. Into an array.
Program Options: 10 Minutes online
Computer Science Dynamics.
Computer Science Sorting.
Computer Science 1 1/19/2011 On the record (paper) write the following
Computer Science 2: Trees
Computer Science 2 Arrays of Records.
Arrays Topics Definition of a Data Structure Definition of an Array
How do you store a bunch of similar stuff?
Computer Science 1 Warm-up: True/False Dry Run
Computer Science
Deleting from a binary tree
Computer Science 2 Tally Arrays 2/4/2016.
CS 2 Records 2/22/2018.
Truth tables: Ways to organize results of Boolean expressions.
AP Java 9/21/2018.
How can you make a guessing game?
Computer Science II Second With files.
Computer Science Procedures Day 2.
Sorting Develop a sorting algorithm
Continue with Life, Magic and Catch -up
Computer Science 2 More Trees.
Computer Science Procedures Day 2.
Computer Science 1 while
Computer Science 1 For..do loop Dry Run Take notes on the For loop
Deleting from a binary tree
How can you make a guessing game?
Computer Science
How do you store a bunch of similar stuff?
Welcome Back CS 2 2/4/2013 On the record (paper) write the following
Computer Science I: Get out your notes.
Continue on the Valentines program
Computer Science 2 Queue.
Time to finish first stack program
Array Review Selection Sort
Computer Science 2 Queue Day 2.
Program options Write a program for one of the following
Dry Run Fix it Write a program
Program: Mini Phone Book 2/11/2016
Computer Science 1 while
10/27/2016 Dry Run 2 Case Programs Fix it Second Case Program
Random Numbers while loop
Computer Science 1 while
Computer Science 1 Get out your notebook
Computer Science 1 Get out your notebook
Dry Run Fix it Write a program
Arrays Topics Definition of a Data Structure Definition of an Array
File Handling.
A bit of Review Review, Dry Run, Program.
Computer Science II First With files.
Presentation transcript:

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

Dry run the following Use the following for input: 10, 20, 8, 2, 4, -1 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, 8, 2, 4, -1

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

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

Program Get 5 Names, schools, Extra Curricular activity Pushes: Show all the information in a chart. (Name, School, Activity) Let the user enter a name and the program will return their school and extra curricular activity. Modify this to be set up as a menu. (Show all, Find person, Find School’s people (Show a list of all students from the school) Pushes: Improve user friendliness of the program. Include an ‘Add another person’ option to the menu. Calculate how many of people there are from each school. Let it support holding an unknown number of records (but less than 100) Write the program using procedures. Add a menu item to sort the information by name.