Welcome to AP Computer Science JAVA Programming in.

Slides:



Advertisements
Similar presentations
1 CSCE 1030 Computer Science 1 Introduction to Object Oriented Programming.
Advertisements

AP Computer Science A – Healdsburg High School 1 Unit 3 - Classes and Objects - Example.
Fall 2006AE6382 Design Computing1 Object Oriented Programming in Matlab Intro to Object- Oriented Programming (OOP) An example that creates a ASSET class.
1 Objects, Classes, and Packages “Static” Classes Introduction to Classes Object Variables and Object References Instantiating Objects Using Methods in.
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
Modules and Objects Introduction to Computing Science and Programming I.
Object Orientated Concepts. Overview  The world is objects  Defining an object  Not a function, it’s a method  Lets inherit want we can  Objects.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
1 Objects and Classes Introduction to Classes Object Variables and Object References Instantiating Objects Using Methods in Objects Reading for this Lecture:
CS 106 Introduction to Computer Science I 03 / 21 / 2008 Instructor: Michael Eckmann.
Lecture 3. Review (What is Class and Object ?) The world of JAVA contains objects The world of JAVA.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Lecture #4 Agenda Announcements Review Questions? Classes and objects UML class diagrams Creating.
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
Objects & Object-Oriented Programming (OOP) CSC 1401: Introduction to Programming with Java Week 15 – Lecture 1 Wanda M. Kunkle.
Slides prepared by Rose Williams, Binghamton University Chapter 8 Polymorphism Part I.
CS 106 Introduction to Computer Science I 03 / 19 / 2008 Instructor: Michael Eckmann.
ASP.NET Programming with C# and SQL Server First Edition
Week 3 Recap CSE 115 – Spring Constructor Special capability of a class that sets up the initial state of the object. Constructor definitions are.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
Writing a Class (defining a data-type). Create a new project : Project (uncheck the “Create Main Class”)
9-Aug-15 Vocabulary. Programming Vocabulary Watch closely, you might even want to take some notes. There’s a short quiz at the end of this presentation!
Classes Java is an Object-Orented Programming language, and one of the main advantages of OOP is code reuse. Code reuse: write code only once, put it in.
Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Introduction to Object-oriented programming and software development Lecture 1.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals; Apply data abstraction.
Introduction to Object-Oriented Programming
1 Chapter 3 and 6– Classes, Objects and Methods Object-Oriented Programming Concepts – Read it from Java TutorialJava Tutorial Definition: A class is a.
CS 106 Introduction to Computer Science I 03 / 19 / 2007 Instructor: Michael Eckmann.
Introduction to Java and Object-Oriented Programming AJSS Computer Camp Department of Information Systems and Computer Science Ateneo de Manila University.
Chapter 8. About the Midterm Exam.. Exam on March 12 Monday (Tentatively) Review on March 7 Wednesday Cover from Chapter 6 Grades will be out before spring.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
Chapter 1 Object Orientation: Objects and Classes.
Objective You will be able to define and identify the basic components of a java program by taking notes, seeing examples, and completing a lab. Construction.
Agenda Object Oriented Programming Reading: Chapter 14.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
More About Objects and Methods Chapter 5. Outline Programming with Methods Static Methods and Static Variables Designing Methods Overloading Constructors.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Object-oriented Design and Programming CS 2210: SW Development Methods Reading: Chapter 2 of MSD text – Section on UML: look at class diagrams but.
CS0007: Introduction to Computer Programming Classes: Documentation, Method Overloading, Scope, Packages, and “Finding the Classes”
Classes. Student class We are tasked with creating a class for objects that store data about students. We first want to consider what is needed for the.
Working With Objects Tonga Institute of Higher Education.
Liang, Introduction to Java Programming, Sixth Edition1 Objects and Classes Gang Qian Department of Computer Science University of Central Oklahoma.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
CS 139 Objects Based on a lecture by Dr. Farzana Rahman Assistant Professor Department of Computer Science.
Computer Programming 2 Lecture 8: Object Oriented Programming Creating Classes & Objects Prepared & Presented by: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION.
CS 106 Introduction to Computer Science I 03 / 22 / 2010 Instructor: Michael Eckmann.
Matthew Small Introduction to Object-Oriented Programming.
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
OOP Basics Classes & Methods (c) IDMS/SQL News
What About Alice? In Alice, we have seen that we have:  Objects (skater, snowman, snowwoman, camera)  Methods (move, turn, roll, move toward)  Properties.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
OOP in C# - part 1 OOP in C#: –Object Interaction. –Inheritance and Polymorphism (next module). FEN 20121UCN Technology: Computer Science.
Chapter 1 Object Orientation: Objects and Classes.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Seventh step for Learning C++ Programming CLASS Declaration Public & Private Constructor & Destructor This pointer Inheritance.
Introduction to Computer Science What is Computer Science? Getting Started Programming.
Objects, Classes, and Methods (PART 1)
Classes and OOP.
Unit-2 Objects and Classes
Object-oriented Design in Processing
Teach A-Level Computer Science: Object-Oriented Programming in Python
Fundamentals of Programming
Implementing Classes Chapter 3.
Object-oriented Design in Processing
Introduction to Object-Oriented Programming
Object-oriented Design in Processing
Object-oriented Design in Processing
Presentation transcript:

Welcome to AP Computer Science JAVA Programming in

Objective: To identify the components of an object-oriented program written in java.

What is JAVA? Java is a language designed for object-oriented programming, abbreviated OOP. Object-oriented programming is a programming methodology that views a program as a set of objects that interact with each other by means of actions.

What are Objects? An object is a program construction that has data associated with it and that can perform certain actions. For example, if we wanted to write a program to simulate brewing and selling coffee at a coffee shop. One object in our program could be for the different types of coffee that we are brewing and selling.

What other objects could our Coffee Shop program contain?

Each object has certain attributes. An object’s attributes are the information/data associated with it. For example, our coffee object would have attributes such as coffeeType, price, ingredients, temperature, etc. An object’s attributes are a major part of what makes each object unique.

Along with attributes, each object has a set of methods. Methods are the actions associated with the object. Our coffee object could have methods such as mixIngrediants(), brewCoffee(), checkTemperature().

Objects of the same type are said to be from the same Class. In JAVA, we create a class which is basically the definition of an object. The attributes and methods of each individual object are set up in a class. All objects in the same class have the same kind of attributes and methods. To create an object of a certain class, we say we create an instance of the class.

How do we set up a class? First, we must design our class. Class Name:Coffee Attributes (data): Methods (actions): coffee type price special ingredients mix ingredients brew coffee

Once we have finished designing our class, we can then start to code it. Class Name:Coffee Attributes (data): Methods (actions): coffee type price special ingredients mix ingredients brew coffee public class Coffee { private String sCoffeeType; private double dPrice; private String sSpecIngredients; public void mixIngredients( ) { // method definition here } public void brewCoffee( ) { // method definition here } }

In object-oriented programs, we first define classes, and while the program is running, we create objects from these classes to accomplish tasks. // Define Caffe Latte object of type class Coffee Coffee CaffèLatte = new Coffee( ); // Define Caffe Mocha object of type class Coffee Coffee CaffèMocha = new Cofee( );

Coffee CaffèLatte = new Coffee( ); Class Name Object Name Instantiates a new object Constructor ClassName ObjectName = new Constructor( ); Creating and Instantiating an Object

To perform methods (actions) on an object, we must call the object along with its method. //The method that mixes the ingredients is called for the CaffeLatte object (of type coffee). CaffèLatte.mixIngredients( ); //The method that mixes the ingredients is called for the CaffeMocha object (of type coffee). CaffèMocha.mixIngredients( );

CaffèLatte. mixIngredients( ); Object Name Method To have an object perform an action we must have the specific object call the method using the dot operator. Dot operator

Let’s write a simple program. HelloWorld