ITunes Lab Copyright © 2012 Pearson Education, Inc.

Slides:



Advertisements
Similar presentations
The Point Class public class Point { public double x; public double y; public Point(double x0, double y0) { x = x0; y = y0; } public double distance(Point.
Advertisements

Copyright 2008 by Pearson Education Building Java Programs Chapter 8 Lecture 8-3: Encapsulation, toString reading: self-checks: #13-18,
Fields, Constructors, Methods
Lab 10: Bank Account II Transaction List, error checking & aggregation.
Collections & Loops Chapter 5 Copyright © 2012 Pearson Education, Inc.
Chapter 8 Improving Structure with Inheritance. The DoME Example The Database of Multimedia Entertainment We will be storing information about CDs and.
Eiffel examples. Example 1 class C creation default_create feature {ANY} -- the public class data count: INTEGER element: DOUBLE end; features - the data.
CIT 590 Intro to Programming Java lecture 4. Agenda Types Collections – Arrays, ArrayLists, HashMaps Variable scoping Access modifiers – public, private,
TA: Nouf Al-Harbi NoufNaief.net :::
CPSC150 Week 6 notes Chapter 5 and other topics. toString Try to print any class Many print “garbage” (e.g., an address) All classes inherit from Object.
1 What makes a Good Class Original by Dr. Stumpf – modified by Dr V Copyright © Dale Carnegie & Associates, Inc.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Part 1 Conditionals and Loops.
Copyright 2010 by Pearson Education Building Java Programs Chapter 8 Lecture 8-2: Object Behavior (Methods) and Constructors reading:
Random, Collections & Loops Chapter 5 Copyright © 2012 Pearson Education, Inc.
Writing Methods Using if, loops, and variables to implement algorithms Copyright © 2012 Pearson Education, Inc.
Writing Classes (Chapter 4)
Classes and Objects. Topics The Class Definition Declaring Instance Member Variables Writing Instance Member Methods Creating Objects Sending Messages.
6-1 Object-Oriented Design Today we focuses on: –the this reference (Chapter 7) –the static modifier (Chapter 7) –method overloading (Chapter 7)
Object Oriented Design: Identifying Objects
Lab 6: Shapes & Picture Extended Ellipse & Rectangle Classes Stand-Alone GUI Applications.
Java Quiz Bowl A fun review of the Java you should know from CMPT 201 If you don’t know the answers - this week is for you to study up!
Georgia Institute of Technology Creating Classes part 1 Barb Ericson Georgia Institute of Technology Oct 2005.
© A+ Computer Science - public Triangle() { setSides(0,0,0); } Constructors are similar to methods. Constructors set the properties.
Practice Slides Unlabeled. Copyright © 2010 Pearson Education, Inc. Plate 1.
10-Nov-15 Java Object Oriented Programming What is it?
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
CSC1401 Classes - 2. Learning Goals Computing concepts Adding a method To show the pictures in the slide show Creating accessors and modifiers That protect.
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.
Exercise 2 Introduction to C# CIS Create a class called Employee that contains the following private instance variables: Social Securitystring.
Wednesday –POD –I have updated grades in powerschool. If you have a zero for a lab grade, it probably means you didn’t DropItToMe. Please do so. –Slides.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
1 Review for exam 2 CS 101 Spring 2005 Aaron Bloomfield.
Jeopardy Print Me Which loop? Call Me Name Me My Mistake Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final Jeopardy.
Word Counter HW Copyright © 2012 Pearson Education, Inc.
Class Everything in Java is in a class. The class has a constructor that creates the object. If you do not supply a constructor Java will create a default.
Outline Anatomy of a Class Encapsulation Anatomy of a Method Graphical Objects Graphical User Interfaces Buttons and Text Fields Copyright © 2012 Pearson.
Powerpoint slides from A+ Computer Science Modified by Mr. Smith for his course.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Unified Modeling Language
Class Definitions: The Fundamentals Chapter 6 3/30/15 & 4/2/15 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education.
Copyright 2010 by Pearson Education Building Java Programs Chapter 8 Lecture 8-3: Constructors; Encapsulation reading: self-checks: #13-18,
Andrew(amwallis) Classes!
Classes and Objects.
© 2015 Pearson Education, Inc.
Operator Overloading; Class string
© 2015 Pearson Education, Inc.
Objects First with Java Transaction List, error checking & aggregation
CS Week 13 Jim Williams, PhD.
CSC 113: Computer programming II
The this Reference The this reference allows an object to refer to itself That is, the this reference, used inside a method, refers to the object through.
Arrays of Objects.
Encapsulation Inheritance PolyMorhpism
Copyright © 2008 Pearson Prentice Hall Inc.
Copyright © 2008 Pearson Prentice Hall Inc.
תירגול 9 אובייקטים.
Lecture 2: Implementing ArrayIntList reading:
Chapter 7 MATH 1325 Business Calculus Ch.7 Copyright © 2005 Pearson Education, Inc.
Copyright © 2008 Pearson Prentice Hall Inc.
Class Examples.
Copyright © 2008 Pearson Prentice Hall Inc.
Introduction to Objects & Classes
Section 10.5 The Dot Product
Unit 4 Review Answers.
Lecture 15 Inheritance.
Copyright © 2008 Pearson Prentice Hall Inc.
Copyright © 2008 Pearson Prentice Hall Inc.
CSC 205 Java Programming II
Why We Need Car Parking Systems - Wohr Parking Systems
Types of Stack Parking Systems Offered by Wohr Parking Systems
Add Title.
Presentation transcript:

iTunes Lab Copyright © 2012 Pearson Education, Inc.

Exercise: iTunes class Create a class Song with 4 Fields: private String title; private String artist; private String album; private double price; 2 Constructors: default, & with a parameter for each field 9 Methods: getters & setters for each field, and toString Create an iTunes class that stores a list of songs as an ArrayList, and initialize the list to be empty Create a method addSong to the iTunes class Create a main method that adds 3 songs to iTunes (don’t use the default constructor) Copyright © 2012 Pearson Education, Inc.

Create a print method that prints the entire song list using a “for each” loop Create a getTotalPrice method that returns the total cost of the entire song list Create a getMinimumPrice method that returns the song with the lowest price in the list D Copyright © 2012 Pearson Education, Inc.