presentation8 - Objects and Classes Soheil Hassas Yeganeh...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Objects and Classes Soheil Hassas Yeganeh Computer Engineering Department Sharif University of Technology Object vs Class (1) 2 Circle---------------- radius radius=150 radius=100 Object vs Class (2) 3 Circle---------------- radius Shape---------------- color Object vs Class (2) 3 Circle---------------- radius Shape---------------- color color = yellow Object vs Class (2) 3 Circle---------------- radius Shape---------------- color radius=150 color = yellow Object vs Class (2) 3 Circle---------------- radius Shape---------------- color radius=150 color = white color = yellow The Problem 4 The Problem • We need a library to support ordinary operations with geometric shapes . • Let us design it using object oriented approach. • How can we do this? What are the steps ? 4 Informal OOD Steps (1) 5 1. We want to support 4 types of shapes for now: Triangle , Square , Circle , Rectangle . 2. The program should compute the area and circumference of the shapes. 3. The color of the shapes should also be saved. Informal OOD Steps (1) • Establish Objectives and Goals . • What should be supported ? • What are desirable/ undesirable features ? • What do the users need ? 5 1. We want to support 4 types of shapes for now: Triangle , Square , Circle , Rectangle . 2. The program should compute the area and circumference of the shapes. 3. The color of the shapes should also be saved. Informal OOD Steps (2) 6 T r i a n g l e S q u a r e R e c t a n g l e C i r c l e A r e a c i r c u m f e r e n c e C = 2 X π X r A = π X r 2 C = 2 X (a+ b) A = a X b C = 4 X a A = a 2 C = a + b + c A = h X c E v e r y s h a p e h a s a c o l o r ! Informal OOD Steps (2) • Write down any concept, you identify in your problem!...
View Full Document

Page1 / 45

presentation8 - Objects and Classes Soheil Hassas Yeganeh...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online