Question
Draw the UML class diagram only related to the code below and write an overloading constructor, which accepts two arguments for setting the corresponding fields.
Draw the UML class diagram only related to the code below and write an overloading constructor, which accepts two arguments for setting the corresponding fields. The body of this constructor first properly calls another constructor, and then sets another field without using assignment operator. This constructor is for internal usage, within the class itself.
public class City {
protected String cName;
private int cArea;
public City(String cName) {}
void setC (String n) {cName = n;}
void setC (int a) { cArea = a; }
public int getA () { return cArea; }
}
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