Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

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

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91529881
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in C/C++

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As