TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
326.2k
set method is not necessary if constructor parameters are given
Jul 21 2012 3:39 PM
Following one is an incomplete program of number 7 in Chapter4. The program is asking to include a constructor then talking about set method. It is confusing because in my view set method is not necessary if constructor parameters are given. Please complete this program.
using System;
namespace _4e7
{
class MovingHistory
{
static void Main(string[] args)
{
City myCity = new City("Scarborough","Ontario", 100000);
City myFriendCity = new City("British_Columbia", "Victoria", 700000);
}
}
}
class City
{
string cityName;
string cityState;
int population;
public City(string cityName, string cityState, int population)
{
this.cityName = cityName;
this.cityState = cityState;
this.population = population;
}
public string getCityName()
{
return cityName;
}
public string getCityState()
{
return cityState;
}
public int getPopulation()
{
return population;
}
}
Attachment:
chapter4 5_8.zip
Reply
Answers (
9
)
Socket programming in c#
LINQ HELP