Question: QUESTION 6 Crayon -name: String -color: String + Crayon (0) + Crayon (n: String, c: String) + setName(n : String): void + setColor(c: String): void

 QUESTION 6 Crayon -name: String -color: String + Crayon (0) +

QUESTION 6 Crayon -name: String -color: String + Crayon (0) + Crayon (n: String, c: String) + setName(n : String): void + setColor(c: String): void + getName():String + getColor():String 1- Write a class declaration for Crayon class and add the two variables to the class declaration name: This field is a String variable that holds the crayon's name. color: This field is a String variable that holds the crayon's color. 2- The class should have the following constructors: A constructor that accepts the following value as argument and assigns it to the appropriate fields: name and color. A no-arg constructor that assigns an empty strings (') to the name, and an empty strings ("") to the color field. 3- Write mutator methods that store values in these fields and accessor methods that return the values in these fields as in above UML diagram. 4- Once you have written the class, write a separate program that creates two Crayon objects to hold the following data: name color Canary Yellow Manatee Grey

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!