Write a class GraphicsInterperter that reads in a file of graphics commands. The class GraphicsInterpreter should have a method interpretCommands that takes a filename as input (a String), reads the graphics commands from the file, and then returns a Picture with the graphics commands executed on it. The method interpretCommands starts out by creating a 640x480 blank picture, then draws on that, and returns it.

There are two kinds of commands:

“line 10 20 300 400” should draw a line from (10, 20) to (300, 400). You can assume that those are single spaces between the co-ordinates.
“circle 100 200 10” draws a circle whose upper-left hand corner is (100, 200) with a diameter for 10.


An input graphics command might look like:
circle 20 20 100
circle 300 20 100
line 210 120 210 320
line 210 320 310 320
line 20 350 400 350
The main method for GraphicsInterpreter might look like this:
```
public s t a t i c void main ( S t r i n g [ ] a r g s )
{
G r a p h i c s I n t e r p r e t e r i n t e r p r e t e r = new G r a p h i c s I n t e r p r e t e r ( ) ;
S t r i n g f i l e N a m e = F i l e C h o o s e r . getMediaPath ( ” g r a p h i c s ?commands . t x t ” ) ; P i c t u r e p = i n t e r p r e t e r . interpretCommands ( f i l e N a m e ) ;
p . show ( ) ;
}
```
This is left to the student.

Computer Science & Information Technology

You might also like to view...

Which of the following is true about the factors that should be considered when evaluating database business requirements and the associated risk assessments?

A. mission-critical systems provide administrators with a large time window for performing maintenance B. databases that have a high change rate require more frequent backups C. for best performance, backups should be done when the system is under peak load D. a single large database is usually easier to maintain than several smaller databases

Computer Science & Information Technology

A computer’s memory capacity is a function of its __________.

a. bus configuration b. bus length c. word size d. all of the above

Computer Science & Information Technology

Which of the following is NOT a video file extension?

A) .mov B) .mpg C) .jpg D) .avi

Computer Science & Information Technology

On the ____ bar, click Layer, and then click Flatten Image to flatten an image.

a. Layers b. Images c. Standard d. Menu

Computer Science & Information Technology