Question: zyBooks catalog Help / FAQ Victor CHALLENGE ACTIVITY 7 . 5 . 2 : Initialization and constructors. 5 2 8 0 4 0 . 3

zyBooks catalog
Help/FAQ
Victor
CHALLENGE
ACTIVITY
7.5.2: Initialization and constructors.
528040.3489528.93zay7
Jump to level 1
Define a default constructor that initializes the fields rating (integer), state (string), and owner (string) with the default values -1, "Void", and "Unstated", respectively.
Ex: If the input is 4TN Gus, then the output is:
Default values:
Rating: -1, State: Void, Name: Unstated's Deli
After mutator methods:
Rating: 4, State: TN, Name: Gus's Deli
Note: The class's print() method is called before and after the input is passed to the setters
MealEstablishment.java
MealEstablishmentDirectory.java
public class MealEstablishment {
private int rating;
private string state;
private String owner;
Y* Your code goes here */
public void setRating(int mealEstablishmentRating){
rating = mealEstablishmentRating;
}
public void setState(String mealEstablishmentState){
state = mealEstablishmentState;
}
public void setOwner(String mealEstablishmentOwner){
owner = mealEstablishmentOwner;
1
2
 zyBooks catalog Help/FAQ Victor CHALLENGE ACTIVITY 7.5.2: Initialization and constructors. 528040.3489528.93zay7

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!