Question: public class City { // modelling a city protected String cName; // name of the city private int cArea; // area of the city public


public class City { // modelling a city protected String cName; // name of the city private int cArea; // area of the city public City (String cName) { // TO BE COMPLETED } void setc (String n) { cName = n; } void setc (int a) { cArea = a; } public int geta () { return cArea; } } Based on the given class City above (in question 2), write a Java application program, named Smartcity. The main purpose of this new class is to further introduce a class of cities which are regarded as smart in terms of enough smart facilities available. The class of this Java program includes: a) - The class declaration, to declare this class which is a public subclass of the given class city An instance field, named smartF oftype int, representing the total number of smart facilities in the city. A class field, named VSMART_LEVEL of type int, which is also a public constant having value 2 xyz, for checking if the city is very smart". A city is regarded as very smart if its total number of smart facilities is larger than this VSMART_LEVEL. * Use the last 3 digits of your student ID member to replace xyz in the value 2xy2. b) One constructor, accepting two arguments: the first argument is for setting the name and the second is for setting the number of smart facilities. This constructor is expected to be used only within its own package and all its subclasses. The body of this constructor: first calls the corresponding one-argument constructor of its superclass with the right input parameter, then properly sets another field with the right input parameter. c) A method, named dispSC (), accepts no input argument and return no value. o This method simply displays the proper information of the city on console, based on whether the city is "very smart" or not, as the format below: o CityName>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
