Posted by Natalie on Monday, November 9, 2009 at 8:51am.
Constructors is a method that should (generally) be public, have no type and have their names correspond to the name of the class (City in this case).
So you would begin like this:
public City()
{
}
Now you can do the rest of the requirements including:
1. insert two parameters including type, for example String cityName, and int cityPop (they should be different from those of the state variables.
2. Assign the values of these parameters to the state variable name and population.
And, voilą, the constructor will be complete.
Related Questions
Computer Science - Consider the following application files: /JavaCS1/src/...
Visual Basic - what does IntTemp and IntRem mean? and whats wrong with my code, ...
Programming - Here is the question that I need help to write the code for the ...
C++ - class professor {}; class teacher : public virtual professor {}; class ...
Programming - Here is the source code for the Kitty class: public class Kitty { ...
English - Hy guys! I'll write a test tomorrow, and we will have to write a ...
programming - There are several types of room in a hotel. The HotelRoom Class of...
java programming - Provide a class called Letter for authoring a simple letter. ...
computer science - I need to see if someone can hepl me with a c# programming ...
criminal justice - Which of the following theories holds that each citizen ...
For Further Reading