Question: JAVA code Assume that you are creating a class which defines a Garment object. Your class has the following variables: private int garType; private int

JAVA code Assume that you are creating a class which defines a Garment object. Your class has the following variables:

private int garType;

private int garColor;

A. Code the constructor for the Garment class which has two formal parameters whose values are assigned into the class variables.

B. Code a mutator method for the garType variable.

C. Assume that the garType variable contains a 1 for shirt and a 2 for pants, no other values will be loaded into this variable. Likewise the garColor variable contains a 1, 2 or 3 for red, green and blue respectively. Code the toString method for the Garment class which returns a string of the form: color space type. For example if garType contains a 1 (for a shirt) and garColor contains a 2 (for green) the method should return: green shirt

If possible, label the codes per letter of Questions. (//A, //B, //C)

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!