Defines the graphic objects in a scene

Assignment Help C/C++ Programming
Reference no: EM13869205

Instructions

Specification

The first project involves adding several classes to a skeleton project, which reads in a scene definition file that defines the graphic objects in a scene and creates those objects, inserts them into the scene and displays that scene. The UML diagram for the whole project is shown below:

1066_UML diagram for the whole project.png

The code for all the classes shown in black is provided in the attached .zip file. You must complete the project by writing those classes shown in red. The skeleton project contains a parser that will parse a scene definition file that defines the scene to be displayed. The grammar for the scene definition file is shown below:

scene -> SCENE IDENTIFIER number_list graphics END '.'

graphics -> graphic graphics | graphic

graphic -> isosceles | parallelogram | regular_polygon |text

isosceles -> ISOSCELES COLOR number_list AT number_list HEIGHT NUMBER WIDTH NUMBER ';'

parallelogram -> PARALLELOGRAM COLOR number_list AT number_listnumber_list OFFSET NUMBER ';'

regular_polygon -> REGULAR_POLYGON COLOR number_list AT number_list SIDES NUMBER RADIUS NUMBER ';'

text -> TEXT COLOR number_list AT number_list STRING ';'

number_list -> '(' numbers ')'

numbers -> NUMBER | NUMBER ',' numbers

Below is a description of each of the five classes that you must write:

1. The Text class must contain a constructor that is supplied the Color that defines the text color, a Point that specifies the text location and a string containing the text to be displayed. It must also contain a draw function because it is extends the abstract class Graphic. The draw function must draw the text using GLUT bitmap 9 by 15 characters.

2. The ConvexPolygon class must contain a constructor declared protected that is called only by its subclasses. That constructor is passed the number of vertices in the polygon and its color. The number of vertices together with an array of Points that defined those vertices should be protected data elements of the class. It must also contain a draw function because it is extends the abstract class Graphic. That draw function should be used to draw all three types of convex polygons.

3. The IsoscelesTriangle class must have a constructor that is supplied the Color of the triangle, a Point that specifies the location of the top vertex, and the height and width of the triangle. It must allocate the array of Points that defined the triangle and compute their values.

4. The Parallelogram class must have a constructor that is supplied the Color of the parallelogram, two Points that specifies the location of the upper left and lower right vertices in addition to an x offset value that specifies the x distance between the upper and lower left vertices. It must allocate the array of Points that defined the parallelogram and compute their values.

5. >The RegularPolygon class must contain a constructor that is supplied the Color of the polygon, the number of sides, a Point that specifies the location of its center, and the radius, which defines the distance between the center and each of the vertices. It must allocate the array of Points that defined the regular polygon and compute their values.

Sample Input and Output

Below is a sample of a scene definition file that would provide input to the program:

Scene Polygons (500, 500)

Isosceles Color (1.0, 0.0, 0.0) at (20.0, 20.0) Height 100.0 Width 300.0;

Parallelogram Color (0.0, 0.0, 1.0) at (40., 10.) (100., 70.) Offset 10.;

RegularPolygon Color(1.0, 0.0, 1.0) at (-100., 100.) Sides 6 Radius 80.;

Text Color(0.0, 0.0, 0.0) at (-200., 200.) "Hello World";

End.

Shown below is the scene that should be produced when the program is provided with the above scene definition.

Attachment:- 1313187_2_Project-1-Skeleton-Code.zip

Reference no: EM13869205

Questions Cloud

What exactly did eckert and mauchley patent and why : What exactly did Eckert and Mauchley patent and why did the judge feel their system was based on Atanasoff's earlier work?
Prepare a report on the current state of municipal solid : Select a Region/Country/State/City of your choice and prepare a report on the current state of municipal solid waste management. Such report, normally referred to as the baseline report, could include the following topics:
The company had recorded depreciation : The Tate Company began 2010 with a Retained Earnings account balance of $180,000. During 2010, the following eight events occurred and were properly recorded by the company:
Major aspects that demonstrate old and new world exchanges : major aspects that demonstrate old and new world exchanges
Defines the graphic objects in a scene : The first project involves adding several classes to a skeleton project, which reads in a scene definition file that defines the graphic objects in a scene and creates those objects.
What elements of mcdonaldization can you find : Describe ways in which McDonaldization is evident in a number of familiar settings (not just the workplace, but perhaps shopping malls and even the college campus). What elements of McDonaldization can you find
Explain the variety of motivational theories and job design : Explain the variety of motivational theories and job design considerations
Explain the green chemistry and its applications : Explain the Green Chemistry and its Applications.The number of pages should be between 12 to 15. write about the Green chemistry's principal.
Differentiate between strategic management and thinking : Differentiate between strategic management strategic thinking

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd