Repetition in Control flow; Array data structure Chapter 5.

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

© 2011 Pearson Education, publishing as Addison-Wesley Chapter 3: Program Statements 3.6 – Iterators – p
Written by: Dr. JJ Shepherd
MELODY A very important element of music! Music 4 th -6 th gradesStephenie Wheeler.
Games and Simulations O-O Programming in Java The Walker School
09 Inheritance. 2 Contents Defining Inheritance Relationships of Inheritance Rules of Inheritance super and this references super() and this() methods.
OBJECT-ORIENTED PROGRAMMING. What is an “object”? Abstract entity that contains data and actions Attributes (characteristics) and methods (functions)
ECE122 L16: Class Relationships April 3, 2007 ECE 122 Engineering Problem Solving with Java Lecture 16 Class Relationships.
16/22/2015 2:54 PM6/22/2015 2:54 PM6/22/2015 2:54 PMObject-Oriented Development Concept originated with simulating objects and their interactions. Adapted.
CS 106 Introduction to Computer Science I 11 / 16 / 2007 Instructor: Michael Eckmann.
CS 117 Spring 2002 Class and Function Reuse derived classes templates.
JavaScript Programming an Introduction Prepared By P.D. Krolak and M.S. Krolak Based on material from JavaScript Unleashed (2nd Ed)
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
Games and Simulations O-O Programming in Java The Walker School
Learn the musical alphabet of the piano keyboard Introduction to the musical alphabet.
Chapter 5 - Making Music: An On-Screen Piano
LECTURE 07 Programming using C# Inheritance
Object Oriented Software Development
MIT AITI 2002 Abstract Classes, Interfaces. Abstract Classes What is an abstract class? An abstract class is a class in which one or more methods is declared,
Accidentals, steps, scales Sharps(#) Flats(b). Look at the keyboard and notice how the sharps and flats are laid out.. A sharp is defined as the note.
INTRODUCTION TO THE KEYBOARD. The Keyboard Black keys are grouped into sets of 2’s and 3’s cc Low SoundsHigh Sounds.
Introduction to the keyboard
CS-434: Object-Oriented Programming Using Java Week 2
CPSC1301 Computer Science 1 Chapter 11 Creating Classes part 1.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Java ProgrammingtMyn1 Java Programming Timo Mynttinen Mikkeli University of Applied Sciences.
APCS Java AB 2004 Review of CS1 and CS2 Review for AP test #1 Sources: 2003 Workshop notes from Chris Nevison (Colgate University) AP Study Guide to go.
Chapter 9 Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design.
Lists and the Collection Interface Review inheritance & collections.
ECE 122 March 24. Motivation I am tasked to write two classes, one for cat, one for sheep. That is easy. I roll up my sleeve and get it done!
These materials where developed by Martin Schray. Please feel free to use and modify them for non-commercial purposes. If you find them useful or would.
P Chapter 2 introduces Object Oriented Programming. p OOP is a relatively new approach to programming which supports the creation of new data types and.
Chapter 11 More about classes and OOP. Relationships Between Classes Possible relationships – Access ("uses-a") – Ownership/Composition ("has-a") – Inheritance.
Object Oriented Programming (OOP) is a style of programming that incorporates these 3 features: Encapsulation Polymorphism Class Interaction.
Inheritance. What Is Inheritance? Familiar examples: –A family tree (individuals inherit characteristics from other individuals) –A taxonomy (classes.
Inheritance Objectives: Creating new classes from existing classes The protected modifier Creating class hierarchies Abstract classes Indirect visibility.
Lab 1 Logbook ADT. OVERVIEW A monthly logbook consists of a set of entries, one for each day of the month.
Chapter 16 Multimedia F Audio Files F Playing Audio F Running Audio on a Separate Thread F Displaying Images F Displaying a Sequence of Images  Using.
© 2007 Lawrenceville Press Slide 1 Chapter 8 Objects  A variable of a data type that is a class. Also called an instance of a class.  Stores data  Can.
Coming up: Inheritance
Encapsulation, Inheritance, Composition. Class Methods Can be either void or return Can have parameters or not Must be static Should be public Know how.
Introduction to Matlab Module #8 Page 1 Introduction to Matlab Module #8 – Animation Topics 1.getframe 2.pause 3.Plotting a set of files Textbook Reading.
© 2007 Lawrenceville Press Slide 1 Chapter 9 Inheritance  One class is an extension of another.  Allows a class to define a specialized type of an existing.
CS 5JA Introduction to Java Pop Quiz Define/Explain encapsulation. In object-oriented programming, encapsulation refers to the grouping of data and the.
Written by: Dr. JJ Shepherd
1 Inheritance Inheritance is a natural way to model the world in object-oriented programming. It is used when you have two types of objects where one is.
Java Programming, Second Edition Chapter Three Using Methods, Classes, and Objects.
Object Oriented Programming in C++ Chapter 7 Dynamic Binding.
Basic Syntax อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 2.
Classes: A Deeper Look D & D Chapter 9 Instructor - Andrew S. O’Fallon CptS 122 Washington State University.
OOP, Inheritance and Polymorphism Lecture 6. Object relations  Inheritance is ‘a kind of’, ‘a type of’ e.g. a revolver is a type of gun  Aggregation.
Chapter 11 An introduction to object-oriented design.
Chapter 14: Multimedia Audio Files Audio Files Playing Audio Playing Audio Running Audio on a Separate Thread Running Audio on a Separate Thread Displaying.
SUBCLASSES - JAVA. The Purpose of Subclasses Class Farm String getOwner() void setOwner(String s) int getSize() void setSize(int s) Class DairyFarm String.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Chapter 5 – Making Music: An On-Screen Piano (Part 1 – Using Loops)
Chapter 5 – Making Music: An On-Screen Piano (Part 2 – Using Arrays)
Can perform actions and provide communication
Alice in Action with Java
Can perform actions and provide communication
Pre-AP® Computer Science Quiz Key
Pre-AP® Computer Science Quiz
Can perform actions and provide communication
Class Examples.
PreAP Computer Science Quiz
Final Exam Review Inheritance Template Functions and Classes
Chapter 11 Classes.
Day 11 The Last Week!.
Chapter 4 Test Review First day
Presentation transcript:

Repetition in Control flow; Array data structure Chapter 5

Key Class Key //class name //Data private boolean isDown; // key status not down or down private String key; //key name private String sound; // key sound //methods //constructor: to initialize the characteristic of the key public Key (String keyName, String soundFile) // create a Key object and initialize // other methods public void act () // mimic the motion of the key going down: animating the key public void play() // play the sound corresponding to the key: producing the sound ….

Piano Class Piano //data whiteKeys // keyboard keys corresponding to white keys whiteNotes //wave files for white keys blackKeys blackNotes //methods Default constructor // instantiate Key object for the keys and place them on the Piano public void makeKeys()

Classes and Relationships Piano Actor Key IS A Inheritance relationship HAS A Aggregation relationship1 n

New Concepts Classes and relationships: is-a and has-a relationships Array data structure to store key information (letter, sound) Loop control structure to repeat operations/instructions

10 things We will do it next class