Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in java You will need to add the methods to the writingTool class: * Create a constructor class which will be take in all

Write in java

You will need to add the methods to the writingTool class:

* Create a constructor class which will be take in all four properties * Create setters and getters for properties, except the dye level. Dye level can only be set in the constructor methods. The get dye level will exist and report the amount of dye remaining. * create a write method which when a string is passed for each character takes 1/1,000 of a dye level. Dye level cannot be negative. If the level is 0 and the write method is called, an error message is provided. The input will be taking from the scanner object and printed to the console. If a clear plastic shell, red colored, 100 leveled pen is used, the output to console will state "" Input. The beginning of output will state the writing tool used. * Print details method, prints the type of shell, the dye name, dye color and the dye level.

Create a new class which creates a red pen. work through all the permutations to test the red pen until you think you have all the code correct.

Next create another class which creates an art box of pens and pencils for each color we have defined. Thus you will create an array of writingTool to define everything.

here is the code needed to work with:

public class writingtool { private String shell; private String dye; private int dyeLevel = 0; private NamedColor dyeColor;

//Put class details here. public enum Color { RED, YELLOW, BLUE, BLACK, ORANGE, GREEN, BROWN, PURPLE; //each is an instance of Color } // end enum Color public enum NamedColor { BLUE(Color.BLUE, "Blue"), RED(Color.RED, "Red"), YELLOW(Color.YELLOW, "Yellow"), BLACK(Color.BLACK, "Black"), ORANGE(Color.ORANGE, "Orange"), GREEN(Color.GREEN, "Green"), BROWN(Color.BROWN, "Brown"), PURPLE(Color.PURPLE, "Purple");

private final Color awtColor; private final String colorName;

private NamedColor(Color awtColor, String name) { this.awtColor = awtColor; this.colorName = name; }

public Color getAwtColor() { return awtColor; }

public String getColorName() { return colorName; } } }

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_2

Step: 3

blur-text-image_3

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

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

What standards define related parties, and what is the definition?

Answered: 1 week ago

Question

Classify delivery styles by type.

Answered: 1 week ago