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

JAVA

JAVA 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

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; } } 3. (20 marks) Based on what we have learnt in our course with our course materials, answer the following questions. 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: o a) o The class declaration, to declare this class which is a public subclass of the given class City An instance field, named smart F of type int, representing the total number of smart facilities in the city. O A class field, named VSMART_LEVEL of type int, which is also a public constant having value 2xyz, 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 V SMART_LEVEL. * Use the last 3 digits of your student ID number to replace xyz in the value 2xyz. [5 marks] 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. [5 marks] O O O c) A method, named dispSC (), accepts no input argument and return no value. 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Question Find io in the circuit of figure 1 using superpositio... View full answer

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!