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

  Prepare a program to print the permutation

write a program to print the permutation that lexicographically precedes the given input permutation. If the given permutation is the lexicographically least permutation, then print the input permutation itself.

  The relative strengths of acids and bases table

List, in a general way, the information that is provided in the Relative Strengths of Acids and Bases table. Explain how the information in the Relative Strengths of Acids and Bases table is used to support your work in this unit. Use examples to su..

  Write a function named digit_name

Write a function named "digit_name" that takes an integer argument in the range from 1 to 9 , inclusive, and prints the English name for that integer on the computer screen.

  Give a complete pseudo-code description of the recursive

Give a complete pseudo-code description of the recursive merge-sort algorithm that takes an array as its input and output.

  You should use pure recursive calls

You should use pure recursive calls completely and count the number of calls the program makes. You should count how many times recursive calls were made.

  Write a gui application that prints out hello

Write a GUI application that prints out "Hello!" in either: English, French, or Spanish. When the user selects another language, the greeting shown in the greeting area should change. Your GUI should look like the interface shown below

  Write a function that permanently swaps two floats

Write a function that permanently swaps two floats using references.

  The owner of a hardware store and need to keep an inventory

You are the owner of a hardware store and need to keep an inventory that can tell you what tools you have, how many you have and the cost of each one. Write a C program to create a file named storage.dat and write the data shown in the Table 1 into t..

  Section instance variables and encapsulation

What is the public interface of the counter class in section instance variables and encapsulation?

  Write a program that grades an online quiz

write a program that grades an online quiz. The program asks the student to enter his/her answer to 10 multiple-choice questions. The program stores the student's responses in an array and then compares those responses to the correct answers to de..

  Build a definition for a class that stores data

Using C++ language, build a definition for a class that stores data about a two dimensional vector. The class has to have mutators and accessors to get and set the x and y values. Make x and y integers. Then overload the operator * so that it retu..

  Downloading movies, and completing schoolwork

Allison spends a lot of time socializing with friends on Facebook, downloading movies, and completing schoolwork. But her older computer needs to be replaced because the latest operating system cannot be installed on her older machine without signifi..

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