Java skeleton program

Assignment Help JAVA Programming
Reference no: EM133323139 , Length: 8 pages

Organization of Programming Languages

Project: The first programming project involves extending the Java skeleton program that it is provided in the attached .zip file. That skeleton program displays a scene of graphic images contained in a scene definition file. The grammar for that scene definition file is shown below:
scene → SCENE IDENTIFIER number_list images END '.' images → image images | image
image → right_triangle | rectangle

right_triangle →
RIGHT_TRIANGLE COLOR number_list AT number_list HEIGHT NUMBER WIDTH NUMBER ';'

rectangle →
RECTANGLE_ COLOR number_list AT number_list HEIGHT NUMBER WIDTH NUMBER ';'

number_list → '(' numbers ')'

numbers → NUMBER | NUMBER ',' numbers

In the above grammar, terminal symbols are upper case names or character literals shown in blue and nonterminal symbols are lower case names shown in red. EBNF metacharacters are shown in black. Tokens can be separated by any number of spaces. Identifiers and keywords are strings of alphabetic characters. Both are case sensitive. Numbers are unsigned integers.

That program reads in the scene definition file that defines the image objects in a scene and creates those objects, inserts them into the scene and displays that scene.

You are to modify the program so that it will parse and display the additional images defined by the expanded grammar shown below with the additions to the grammar highlighted in yellow:

scene → SCENE IDENTIFIER number_list images END '.' images → image images | image
image →
right_triangle | rectangle | parallelogram | regular_polygon | isosceles
| text

right_triangle →
RIGHT_TRIANGLE COLOR number_list AT number_list HEIGHT NUMBER WIDTH NUMBER ';'

rectangle →
RECTANGLE_ COLOR number_list AT number_list HEIGHT NUMBER WIDTH NUMBER ';'

parallelogram →
PARALLELOGRAM COLOR number_list AT number_list number_list OFFSET
NUMBER ';'

regular_polygon →
REGULAR_POLYGON COLOR number_list AT number_list SIDES NUMBER RADIUS
NUMBER ';'

isosceles →
ISOSCELES COLOR number_list AT number_list HEIGHT NUMBER WIDTH
NUMBER ';'

text →
TEXT COLOR number_list AT number_list STRING ';' number_list → '(' numbers ')'
numbers → NUMBER | NUMBER ',' numbers

The UML diagram for the whole project is shown below:

The classes shown in black are included in the skeleton project. You must complete the project by writing those classes shown in red and modifying the Parser class so that it will parse the expanded grammar. Below is a description of each of the five classes that you must write:

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 Image. The draw function must draw the text using the method drawString in Graphics class.

The SolidPolygon class must contain a constructor that is passed the number of vertices in the polygon and its color. It must define the method drawPolygon because it is extends the abstract class Polygon_. It should call the fillPolygon method of the Graphics class to draw a solid polygon.

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 arrays of x and y coordinates that defines the triangle and it must compute their values.

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 arrays of x and y coordinates that defines the parallelogram and it must compute their values.

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 arrays of x and y coordinates that defines the regular polygon and it must compute their values.
Below is a sample of a scene definition file that would provide input to the program:

Scene Polygons (500, 500)
RightTriangle Color (255, 0, 0) at (50, 30) Height 100 Width 300;
Rectangle Color (0, 128, 255) at (100, 100) Height 200 Width 100;
Isosceles Color (255, 0, 0) at (120, 120) Height 100 Width 200;
Parallelogram Color (0, 0, 255) at (340, 50) (440, 120) Offset 30;
RegularPolygon Color(255, 0, 255) at (300, 300) Sides 6 Radius 80;
Text Color(0, 0, 0) at (400, 200) "Hello World"; End.

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

697_Programming Languages.jpg

 

The deliverables for this project include the following:

1. A .zip file containing all the source code correctly implementing all required functionality.
a. All the .java files provided in the skeleton should included regardless of whether they required any changes
b. All new files must include a header with the student name, date, project and a description of what the file contains
c. All modified files must include a header with the same information

2. A Word or PDF file that contains the following:
a. A discussion of how you approached the project
b. A test plan that contains test cases that include all additional images and test any new functionality. For each test case, the output produced should be included.
c. A discussion of lessons learned from the project and any improvements that could be made.

Attachment:- Organization of Programming Languages.rar

Reference no: EM133323139

Questions Cloud

Refute particular claim to promote good cause : An infographic showing how statistics can support or refute a particular claim to promote a good cause.
What does the concept of business and social impacts mean : What does the concept of 'business and social impacts' mean to you as a future business stakeholder? What insights have you learnt that underpins the future
Woman of the congregation-language comprehension : At your church, there is a woman of the congregation whose child is struggling with language.
What form of political system exists : Analysis of political, economic, cultural, legal and ethical risks in the country selected (30%] In relation to the country risk analysis
Java skeleton program : CMSC330 Organization of Programming Languages, The University of Maryland - defines the text color, a point that specifies the text location and a string
Positive or negative impact on the workforce : Do you think that the population of the Baby Boomers will have a positive or negative impact on the workforce?
What are the issues described in the case : What are the issues described in the case? Use as many theories learned in class, you shall use two or three Hofstede's or Trompenaars-Hampden's dimensions
How does employees perceived organizational justice affect : How does employees' perceived organizational justice affect employees' work attitudes and behaviors? How do leadership behaviors affect employees' perceived
Explain elements of the system now that you have reframed it : Introduction and explanation of why food sustainable food production and distribution across the globe is a wicked problem.

Reviews

len3323139

1/26/2023 9:04:34 PM

I need this to be done perfectly in tomoorrow with all requirements to be fulfilled

Write a Review

JAVA Programming Questions & Answers

  Modify java application where all of interaction is perform

Modify your Java application so that it is an easy-to-use GUI application where all of the interaction is performed on one screen.

  Correct the methods code

Correct the methods code - System out println

  Write an interface for a bagadt that implements iterable

Write an interface for a BagADT that implements the Iterable interface. Include javadoc comments that will generate specifications for the BagADT so that someone who wants to implement this interface will know what each method does.

  What is overloading and what is overriding

What is overloading and what is overriding? Wrtie JAVA code code to explain it.

  Marketing necessary for practice-hospital to successful

Why is marketing necessary for a practice or hospital to be successful? What considerations should be taken into account when marketing health care services or products? (Hint think about all the medication ads you seen on tv or in magazines)

  Develop applications involving complex component technology

Enterprise Programming - Describe elements of a common object oriented programming language suitable for web based application development

  Build an android application to execute some of the queries

Build an android application to execute some of the queries -

  Database implementation using MS Access Assignment

Part A - Database implementation using MS Access - Map the ERD, from the sample solution, into a set of relations in at least Third Normal Form (3NF)

  Calculate the total hours of over lapping meetings

Suppose you have a meeting room which can hold multiple meetings and the smalled duration of meeting can be 30 mins. Calculate the total hours of over lapping meetings.

  Assignment on java applets and activex controls

Go online and search for information about security threats posed by Java applets and ActiveX controls. Note that most of these programs are small in size and downloaded onto computers over the Internet.

  Write program that will simulate rolling a die

Run this program several times to show different results. Remember, Math.random() generates a double value with a positive sign, greater than or equal to 0

  Write methods to retrieve information about a note

calculate the frequency, use the formula 440 x 2^(n/12) where n is the note number - implement a class that will be used to hold information about a musical note.

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