Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java please ASAP Java please Description Write a program that reads a list of graphics primitives from a text file and draws them in

In Java please ASAP

Java please

Description

Write a program that reads a list of graphics primitives from a text file and draws them in a window. This assignment creates a set of Java classes in a very primitive hierarchy to model the various graphics primitives: text, squares, rectangles, triangles, and circles, and ovals. Each primitive has a different set of attributes, for example text has font name, style, and size, and a rectangle has color, width, and height, etc. When your program is complete, you will be able to see the contents of the text file rendered inside of a window. In the next assignment you will substitute a more complex hierarchy of classes that takes advantage of inheritance to reduce duplication and force consistent behavior among graphics primitives. You will also another primitives, polygon.

Create a project called P2.

Download and import P2-starter.jar - https://www.cs.colostate.edu/~cs165/.Spring18/assignments/P2/archive/P2-starter.jar

This link will give you a downlaod to export into eclipse or another programming system. This will include all the txt files and other starter jars

Where ever there is a PLACE CODE HERE I need code.

Also in this project these classes need to be inplemented

Add New Classes

Create the following classes:

Square

Rectangle

Triangle

Circle

Oval

Text

Each shape should inherit from the Primitive class. For example:

public Square extends Primitive { 

Implement the Shape Classes

Each shape requires certain fields and methods. This includes location, size, color, etc. You will need to figure out what each class should include through analyzing the following sources:

The code in the DrawProgram and UserInterface classes.

The code in the DrawProgram class is not complete, this will be the next part of your assignment. However, you should able to deduce what each shape needs from the code that is already provided.

Complete the code in the DrawProgram class

The main method calls load, passing args[0] as the name of the text file containing graphics primitives, then it calls draw to draw the primitives. Try running the program with the files corresponding to the Text, Square, or Rectangle classes.

Once you have successfully tested these classes, complete the code for the following methods:

public ArrayList load(String filename); public void draw(ArrayList primitives); 

Sample Output

The image below shows the output from the simplePrimitives file:

image text in transcribed

Drawing Application Number Primitives: 37 Programming is Fun Java Rules! Computer Science Drawing Application Number Primitives: 37 Programming is Fun Java Rules! Computer Science

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

=+3. What are the characteristics of media enterprises?

Answered: 1 week ago

Question

=+1. What are the product specifications of media products?

Answered: 1 week ago