Lecture 6 – Exercises TCP1201: 2017/2018.

Slides:



Advertisements
Similar presentations
Abstract Classes We often define classes as subclasses of other classes – First, define the superclass – In some cases, a superclass may not have enough.
Advertisements

Lecture 17 Abstract classes Interfaces The Comparable interface Event listeners All in chapter 10: please read it.
TA: Nouf Al-Harbi NoufNaief.net :::
Programming 2 LAB TA: Nouf Al-Harbi NoufNaief.net :::
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○
Using Jeroo To Teach Object-Oriented Concepts By Christian Digout.
UML Class Diagram. A class diagram shows 1.Classes 2.The relationships between them.
COME 339 WEEK 1. Example: The Course Class 2 TestCourceRunCourse.
UML2-1 UML Exercise A "draw" utility program lets users draw several geometric objects on a diagram. A geometric object may be a Circle, Rectangle, Square.
SHAPES There are many shapes in our world. These are circles. Circles are never ending lines.
SUBCLASSES - JAVA. The Purpose of Subclasses Class Farm String getOwner() void setOwner(String s) int getSize() void setSize(int s) Class DairyFarm String.
Lecture 5:Interfaces and Abstract Classes Michael Hsu CSULA.
Lecture 6:Interfaces and Abstract Classes Michael Hsu CSULA.
CS-2852 Data Structures Week 5, Class 3 – Testing and Recursion Queue Implementing finite queues Binary Search Recursion Tomorrow – Quiz, Lab demos, Lab.
From Word Embeddings To Document Distances
On Robust Neighbor Discovery in Mobile Wireless Networks
C H A P T E R 17 Waves and Sound
Examples and NXT Mindstorms Kit
Price Elasticity of Demand (PED)
Important Terms computers interconnected by communication network
Secret from Muscle: Enabling Secure Paring with Electromyography
Water Balance, Electrolytes, Acid-Base Disorders
ENZYMES- action and inhibition
History and Philosophy of the Black Hole Information Paradox
Santa Barbara County SELPA Parentally Placed Students in Private School Training & Meaningful Consultation for Private School Representatives and Parent.
PL/SQL.
Portfolio Committee on Higher Education & Training 07 September 2016
Dewey Decimal System Chattahoochee.
Factors affecting weight retention after pregnancy
with short-lived fixes?
Cosponsored by: PropertyCasualty360 and InsideCounsel
Control Chart Builder (CCB) Process Capability
Stylized facts of a dualistic developing economy
Imperialism 1 By the 1800’s many were calling for the U.S. to join the ranks of the world’s powers and abandon isolationism. From the mid-1800’s to the.
3.2 – Modeling a gas.
Disruptors in the Auto Industry. Where
Geotechnical Engineering II CE 481
Chaotic Scattering without and with Time Reversal Violation in Open Microwave Billiards Modelling Nuclei ECT* 2017 Classical-, quantum- and microwave.
Conditional Probability
Quadrat Sampling Chi-squared Test
Lecture 5:Interfaces and Abstract Classes
Learning to Give a Bible Study
Initial Racetrack design 5M straight sections He MeV stage
Spheres Warm Up Lesson Presentation Lesson Quiz Holt McDougal Geometry
Behavioral Finance: Asset Pricing
Hartle-Hawking wave function and large-scale power suppression of CMB
Dmitry Onishchenko James Dunyak, Nidal Al-Huniti
Neural Networks from Scratch
MAT116 Final Review Session Chapter 4: Exponential and Logarithmic Equations, Section 5.1: Systems of Linear Equations and Inequalities, and Section 6.1:
Year 7 Pythagoras’ Theorem
Strategic Interaction and the environment
A Zero-Order Picture of the Infrared Spectra of CH3O and CD3O:
Type I / Type II Error Control in Drug Development
Microsoft digital literacy
Lecture 23:More on Interfaces
Abstract Classes and Interfaces in Java Reference: COS240 Syllabus
Interface, Subclass, and Abstract Class Review
ECET 370 ASSIST Something Great/ecet370assist.com
ECET 370 Slingshot Academy / ecet370.com
Lecture 4 – Case Study TCP1201: 2017/2018.
Name the shape below. rectangle rhombus square triangle A B C D
ABSTRACT FACTORY.
CS 302 Week 10 Jim Williams.
Object Oriented Analysis and Design
Chapter 19 Generics Jung Soo (Sue) Lim Cal State LA.
Chapter 13 Abstract Classes and Interfaces Part 01
Chapter 19 Generics.
Chapter 11 Inheritance and Encapsulation and Polymorphism
Warmup Which of the 4 sorting algorithms uses recursion?
This is a square. This is a square. How can you tell. How can you tell
Presentation transcript:

Lecture 6 – Exercises TCP1201: 2017/2018

Exercise 1 (Shuffle ArrayList) Write the following method that shuffles an ArrayList of numbers: public static void shuffle(ArrayList<Number> list) (Programming Exercises from textbook: 13.6)

Exercise 2 (The ComparableCircle class) Define a class named ComparableCircle that extends Circle and implements Comparable. Draw the UML diagram and implement the compareTo method to compare the circles on the basis of area. Write a test class to find the larger of two instances of ComparableCircle objects. (Programming Exercises from textbook: 13.6)

Exercise 3 (The Colorable interface) Design an interface named Colorable with a void method named howToColor(). Every class of a colorable object must implement the Colorable interface. Design a class named Square that extends GeometricObject and implements Colorable. Implement howToColor to display the message Color all four sides. Draw a UML diagram that involves Colorable, Square, and GeometricObject. Write a test program that creates an array of five GeometricObjects. For each object in the array, display its area and invoke its howToColor method if it is colorable. (Programming Exercises from textbook: 13.7)