Question: Write a class named Food with the following specifications: (1 points) Name the class Food (3 points) Create the following instance variables: String name,

Write a class named Food with the following specifications: (1 points) Name the class Food (3 points) Create the following instance variables: String name, double weight, and String taste (2 points) Create a constructor that will be blank (4 points) Create another constructor that will take in three arguments: name, weight and taste. Use the this keyword to assign the instance variables values based on the arguments passed in by the constructor. HINT: public Food(String name, int weight, String taste) (12 points) Create an accessor (aka get) and a mutator (aka set) method which will get and set the weight and taste instance variables of the Food class. (Total of 4 methods) (3 points) Create a method called "public String data()". This method will return a String which will contain the name, weight, and taste of the fruit.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
