Lab8 - perimeters of the objects Classes definition You shall define a GeometryObject class as the parent of Circle Rectangle and Triangle classes

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab 8   CS101  Fall 2007 Objective File I/O Class definition and object creation Object array Inheritance and polymorphism Lab description In this lab, you are going to write a program that read a set of geometry objects from a text file. The  geometry objects are of three types: circle, triangle and rectangle. In the text file, the first number  indicates the type of an object, the other number specifies the property of the object. 0 stands for circle, 1  stands for triangle, and 2 stands for rectangle. For example, the following three lines specify a circle with  radius equal to 5, and a triangle with three sides equal to 3, 4, 5, and a rectangle with two sides equal to 4,  5. 0  5 1  3  4  5 2   4  5 After reading the objects into an array, you shall compute the the sum of the areas, and the sum of the 
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: perimeters of the objects. Classes definition You shall define a GeometryObject class as the parent of Circle, Rectangle, and Triangle classes. The methods getArea and getPerimeter should be declared in the GeometryObject as abstract methods, and implemented in the subclasses. Grade ● Definition of the GeometryObject class, 20 points ● Definition of the subclasses, 20 points ● Implementation of the getArea and getPerimeter methods, 20 points ● Reading Objects from the text file, 20 points ● Print out the sum of areas and sum of perimeters, 10 points ● Report, 10 points Submission ● source code ● report...
View Full Document

This note was uploaded on 04/29/2008 for the course CS 101L taught by Professor Vineyard during the Fall '07 term at Kettering.

Ask a homework question - tutors are online