{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab8 - perimeters of the objects Classes definition You...

Info icon This 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 
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern