Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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: a) O O The class declaration, to declare this class which is a public subclass of the given class City An instance field, named smartF of type 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 number to replace xyz in the value [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: o first calls the corresponding one-argument constructor of its superclass with the right input parameter, o then properly sets another field with the right input parameter. [5 marks] 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 (CityName>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started