Question: in java this is the original restaurant code class Restaurant { private String name; private String address; private String genre; private int numOfRatings; private double

in java this is the original restaurant code class Restaurant { privatein java this is the original restaurant code

class Restaurant { private String name; private String address; private String genre; private int numOfRatings; private double rating; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } public void rate(int score) { rating += score; } public double getRating() { return rating; } public void display() { System.out.println("Name: " + name); System.out.println("Address: " + address); System.out.println("Genre: " + genre); System.out.println("Number of ratings: " + numOfRatings); System.out.println("Rating: " + rating); } } public class Main { public static void main(String[] args) { Restaurant res = new Restaurant(); res.setAddress("Ashlan ave "); res.setGenre("Mexican Food"); res.setName("Martin Spot"); res.rate(9); res.display(); } }

This week I want you to expand upon your Restaurant class from earlier. For credit implement the following features into your class. 1. Create a static field that holds the number of Restaurant profiles that have been added into the system. (i.e. The number of instances of the class Restaurant that have been created.) 2. Create a static method to return the number of Restaurant profiles in the system. 3. Implement the finalize() method to remove a Restaurant from the current number of Restaurants in the system. 4. Implement a Custom Constructor that takes three strings and initializes the name, genre, and address of a Restaurant. The constructor should also increment the Restaurant count. 5. Override the default constructor to increment the Restaurant count as well as initializing all fields to zero or the empty string

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!