Question: public class Item private final String name A label for the item, such as Jewelry or Kindle private final double weight The weight of the
public class Item
private final String name
A label for the item, such as "Jewelry" or "Kindle"
private final double weight
The weight of the item in pounds
private final int value
The value of the item rounded to the nearest dollar
private boolean included.
Indicates whether the item should be taken or not
public ItemString name, double weight, int value
Initializes the Item's fields to the values that are passed in; the included field is initialized to false
public ItemItem other
Initializes this item's fields to the be the same as the other item's
public double getweight
public int getvalue
public boolean isincluded
Getter for the item's fields you don't need a getter for the name
public void setincludedboolean included
Setter for the item's included field you don't need setters for the other fields
public string tostring
Displays the item in the form $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
