In the class definition, initialize the private fields owner (string), rating (integer), and state (string) with the default values "Unstated", -1, and "Undefined", respectively. Ex: If the input is Ken 4 NY, then the output is: Default values: Name: Unstated's Food Truck, Rating: -1, State: Undefined After mutator methods: Name: Ken's Food Truck, Rating: 4, State: NY Note: The class's print() method is called before and after the input is passed to the setters. Eatery.java     public class Eatery {  private /* Your code goes here */ private/* Your code goes here */ private/* Your code goes here */   publicvoidsetOwner(StringeateryOwner) { owner=eateryOwner; }   publicvoidsetRating(inteateryRating) { rating=eateryRating; }   publicvoidsetState(StringeateryState) { state=eateryState; }   publicvoidprint() { System.out.println("Name: "+owner+"'s Food Truck, Rating: "+rating+", State: "+state); } }

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter10: Object-oriented Programming
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question

In the class definition, initialize the private fields owner (string), rating (integer), and state (string) with the default values "Unstated", -1, and "Undefined", respectively.

Ex: If the input is Ken 4 NY, then the output is:

Default values: Name: Unstated's Food Truck, Rating: -1, State: Undefined After mutator methods: Name: Ken's Food Truck, Rating: 4, State: NY

Note: The class's print() method is called before and after the input is passed to the setters.

Eatery.java
 
 

public class Eatery {

 private /* Your code goes here */

private/* Your code goes here */

private/* Your code goes here */
 
publicvoidsetOwner(StringeateryOwner) {
owner=eateryOwner;
}
 
publicvoidsetRating(inteateryRating) {
rating=eateryRating;
}
 
publicvoidsetState(StringeateryState) {
state=eateryState;
}
 
publicvoidprint() {
System.out.println("Name: "+owner+"'s Food Truck, Rating: "+rating+", State: "+state);
}
}
 
 
 
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage