Object Oriented Programming

Slides:



Advertisements
Similar presentations
Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
Advertisements

Copyright 2010 by Pearson Education Building Java Programs Chapter 7 Lecture 7-2: Arrays as Parameters reading: , 3.3 self-checks: Ch. 7 #5, 8,
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
Strings in Java 1. strings in java are handled by two classes String &
1 Working with String Duo Wei CS110A_ Empty Strings An empty string has no characters; its length is 0. Not to be confused with an uninitialized.
Java Strings in 10 minutes
ISQA 360 – July 8, 2002 Methods Dr. Sergio Davalos.
Chapter 15 Strings String::Concat String::CompareTo, Equals, == If( string1 == S”Hello”) String1->Equals(S”Hello”) String1->CompareTo(S”Hello”) CompareTo.
Strings In Java, strings are contained in an object that is an instance of the String class. String in java is the name of a class. That’s why it starts.
Strings Reading for this Lecture, L&L, 3.2. Strings String is basically just a collection of characters. Thus, the string “Martyn” could be thought of.
JAVA LIBRARY CLASSES CITS Main concepts to be covered Using library classes: String, Math, Color Reading documentation Java 7 API is available.
Chapter 2 Practice.
CS0004: Introduction to Programming Variables – Strings.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Unit 3: Java Data Types Math class and String class.
Primitive Types Java offers a number of primitive types eg.) int, short, long double, float char A variable which is declared as a primitive type stores.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
ROUND 1 Name a method associated with class String 1.) 15 compareTo() 26 indexOf() 34 length() 2.) 3.) 4.) 3 toUpper() 7 substring() 11 charAt() 5.)
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Chapter 3A Strings. Using Predefined Classes & Methods in a Program To use a method you must know: 1.Name of class containing method (Math) 2.Name of.
Strings Methods in the String class Manipulating text in Java.
Documentation Javadocs. Design/Documentation An essential ingredient of good Object Oriented programming is known as design by contract. This means that.
1 Predefined Classes and Objects Chapter 3. 2 Objectives You will be able to:  Use predefined classes available in the Java System Library in your own.
Computer Programming 2 Lab (1) I.Fatimah Alzahrani.
Topics Instance variables, set and get methods Encapsulation
Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord.
CPSC 233 Tutorial 5 February 9 th /10 th, Java Classes Each Java class contains a set of instance variables and methods Instance Variables: Type.
Powerpoint slides from A+ Computer Science Modified by Mr. Smith for his course.
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.
3.1 Objects. Data type. Set of values and operations on those values. Primitive/Built-In types. n Usually single values n Can build arrays but they can.
1 reading: 3.3 Using objects. Objects So far, we have seen: methods, which represent behavior variables, which represent data (categorized by types) It.
Strings A String is a sequence of letters
Introduction to Object-oriented Programming
Functions + Overloading + Scope
OBJECT ORIENTED PROGRAMMING
Object-Oriented Concepts
Objects as a programming concept
What is the volume of the cylinder below?
Building Java Programs
Java Course Review.
Foundations of Programming: Arrays
PRG 421 Week 1 Individual: Week One Coding Assignment--
Working with Text and Numbers in Java
Object Oriented Programming (OOP) LAB # 8
Building Java Programs
Building Java Programs
Object Oriented Programming (OOP) LAB # 5
Tonga Institute of Higher Education
Lecture 2: Implementing ArrayIntList reading:
Implementing Classes Chapter 3.
Array and Method.
Java Lesson 36 Mr. Kalmes.
© A+ Computer Science - OOP © A+ Computer Science -
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
Programs and Classes A program is made up from classes
References and objects
Building Java Programs
CSE 142 Lecture Notes Defining New Types of Objects
C++ Programming ㅎㅎ String OOP Class Constructor & Destructor.
Which best describes the relationship between classes and objects?
Chapter 3 Spring 2006 CS 101 Aaron Bloomfield
String.
Object-Oriented Programming
A+ Computer Science PARAMETERS
Topic 25 - more array algorithms
July 7, 2019 Write in your planner and on your stamp sheet:
Day 11 The Last Week!.
Unit-2 Objects and Classes
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

Object Oriented Programming Day 2 Object Oriented Programming

Why OOP https://www.youtube.com/watch?v=qb-hfSRpuVk&feature=player_embedded

String Documentation Method Number of Parameter(s) Parameter Type(s) Return Type length() substring(__ ,__ ) toUpperCase() indexOf(___)

First Object: Day Object—Create a ‘Day Class’ First

Class Website: Files are stored here http://www.codersforcauses.com/ Go to Day 2, open Day, copy code, paste in Day class.

Class-Objects-Methods-Parameters Class—Day Create new Object: day1 (this is an instance of the Day class) What are the methods? Parameters? ______________ ______________

Complete Exercise 1

What methods are defined by the Day classes that can be used by these objects?

See Exercise 3: Download & unzip pictuers2 Variable Names See Exercise 3: Download & unzip pictuers2

Comments—Open the Color Class public class Cone { /** * Gets the volume of a cone * @param r the radius of the cone * @param h the height of the cone */ public double volume(int r, int h) double volume; // volume = (1/3)π*radius^2*height volume = (1.0/3.0)*Math.PI*r*r*h return volume; }

Resources Sheet:  Java Facts:

Documentation View—See Exercise 4—days2 project