Question: Given main ( ) , complete the FoodItem class ( in file Foodltem.java ) with constructors to initialize each food item. The default constructor should

Given main(), complete the FoodItem class (in file Foodltem.java) with constructors to initialize each food item. The default constructor should initialize the name to "Water" and all other fields to 0.0. The second constructor should have four parameters (food name, grams of fat, grams of carbohydrates, and grams of protein) and should assign each private field with the appropriate parameter value.
Ex: If the input is:
Water
the output is:
 Given main(), complete the FoodItem class (in file Foodltem.java) with constructors

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!