COMP 248 Study Guide - Quiz Guide: Regular Polygon

382 views1 pages

Document Summary

Due date: today, at the end of the lab period. Question: implement a class named polygon which describes an n-sided polygon where all sides have the same length, and has: A default constructor that creates a regular polygon with 5 sides, each of length 1. 5, with pink as the fill color and blue as the border color. Second constructor with parameters that accepts four values and initializes n, sides, fill and border to these passed values. The accessor (get) and mutator (set) methods for all data fields. Write the driver class to test the program as follows: Create two objects (e. g. obj1, obj2) using two different constructors. The number of sides in the second constructor should be a number greater than 3, if not, assign a default value (e. g. 3) to it. Ask the user to enter a new border color for obj1. The border color should be (cid:862)red(cid:863), or (cid:862)blue(cid:863), or (cid:863)green(cid:863).

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents