Welcome Back CS 2 2/4/2013 On the record (paper) write the following

Slides:



Advertisements
Similar presentations
Making A Cold Call.
Advertisements

© Dolinski This presentation will help you with the database section of your coursework. It will cover: – What you need to do.
Overview C programming Environment C Global Variables C Local Variables Memory Map for a C Function C Activation Records Example Compilation.
Put Title Here by put your name here Put category here.
Foundation Studies Course M.Montebello Records Foundation Studies Course.
Creating a Bibliography This lesson will teach you how to create a bibliography section at the end of an essay or report.
Arrays and ArrayLists in Java L. Kedigh. Array Characteristics List of values. A list of values where every member is of the same type. Each member in.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
Database Design Shortcuts. What’s your problem? Sort out the basic idea for the Database… e.g. : Your local Angling Club is looking to set up a Database.
Python Repetition. We use repetition to prevent typing the same code out many times and to make our code more efficient. FOR is used when you know how.
Sha Tin Methodist College F.4 Computer Studies Pascal Programming.
Computer Science 1 How do you store a bunch of similar stuff?
Simple “VICO” (“VIPO”) Programs (Variables, Input, Calculating or Processing, Output)
Computer Science 2 Arrays of Records. First Record Program Input an unknown number of Team Names, School names, and Total scores. (While loop) –Output:
My Favorite Song “Song Title” Name. Information about the Artist The five ws about the artist Who they are What type of music they make When did the y.
Quiz # 02 Design a data type Date to hold date
Run-Time Storage Organization
Run-Time Storage Organization
The Maker.
(c)opyright Brent M. Dingle 2001
Program options Write a program for one of the following
Computer Science Dynamics.
CSC 113 Tutorial QUIZ I.
Use proper case (ie Caps for the beginnings of words)
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
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Computer Science 2 Review the Bubble Sort
Continue on the Array of Records program
Insertion Sort Quiz on Thursday.
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Computer Science 2 Arrays of Records.
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Computer Science 2 Getting an unknown # of …. Into an array.
CS2011 Introduction to Programming I Arrays (I)
Computer Science Dynamics.
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Computer Science Sorting.
Computer Science 1 1/19/2011 On the record (paper) write the following
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 2 Tally Arrays 2/4/2016.
CS 2 Records 2/22/2018.
AP Java 9/21/2018.
Sorting Develop a sorting algorithm
Continue with Life, Magic and Catch -up
Computer Science 1 while
How do you store a bunch of similar stuff?
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Continue on the Valentines program
Program options Write a program for one of the following
Computer Science 1 while
CS 2 2/25/2015 File Exists?.
Computer Science 1 while
Dry Run Fix it Write a program
Algorithms For use in Unit 2 Exam.
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays Topics Definition of a Data Structure Definition of an Array
Arrays Introduction to Arrays Reading for this Lecture:
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
A bit of Review Review, Dry Run, Program.
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Year 8 Computer Science Digital Portfolio
Computer Science II First With files.
Presentation transcript:

Welcome Back CS 2 2/4/2013 On the record (paper) write the following Name:______________ Farthest from Salem:____________ Favorite Food: _____________ Favorite College: _____________ Top three college majors:_______________

What would you use if… You needed to store someone’s name, age, and phone number? What about name, strength, skills and position? What about a recipe: Title, Ingredients, instructions, … How about a song title, length of the song, artist name, ranking on your personal favorites list, … Pascal has a ‘data structure’ that can store more than one type of information in a single variable.

Program RecordsExample; type StudType = record name:string; age:integer; gpa:real; end; var Student1,Student2:Studtype; begin writeln(‘Please enter your name’); readln(Student1.name); writeln(‘Please enter your age’); readln(Student1.age); writeln(‘Please enter another name’); readln(Student2.name); writeln(‘Please enter another age’); readln(Student2.age); if (Student1.age) > (Student2.age) then writeln(Student1.name,’ is older’) else writeln(Student1.name, ‘ is not older ‘); end. Student1 Name:________ Age:_________ GPA:_________ Student2

Declarations and stuff In the Type section Rectype = record Field1:field1type; Field2, field3:field23type; … End; In the Var section Recordvariable:Rectype; In the Code Section Recordvariable.Field1:=…;

What do you think this will do? Program RecordsExample; type StudType = record name:string; age:integer; gpa:real; end; var Student1,Student2:Studtype; begin writeln(‘Please enter your name’); readln(Student1.name); writeln(‘Please enter your age’); readln(Student1.age); writeln(‘Please enter another name’); readln(Student2.name); writeln(‘Please enter another age’); readln(Student2.age); if (Student1.age) > (Student2.age) then writeln(Student1.name,’ is older’) else writeln(Student1.name, ‘ is not older ‘); Writeln(Student); end. Common errors Putting a ; here Forgetting the ‘end.’ What do you think this will do?

Write the declarations (Type and var) for a variable that needs to hold… Team Name, School, Total score (For a swim meet, wrestling meet, track meet, …) Project Leader name, Three goals (Sentences), Money allocated for the project, Project due date. Student name, Student ID number, Class schedule.

First Record Program Input an unknown number of Team Names, School names, and Total scores. (While loop) Output: The winning team. That is the team with the highest score. (If there is a tie, just show the first team with the top score.) (Note, you don’t need an array for this program.) Push: Same input as above, and show the schools with the top five scores. (You do need an array and a sort for this one.)