Answer to Question #15674 in C# for Zulekha
Create a console application with a class ‘Account’ having variables as id(int) and name (String).Add property ‘account-no’
which can be set andget. Add a ‘ReadOnly’ property ‘IntRate’ and ‘WriteOnly’ property‘Password’ for this class. Add a
shared property ‘Branch’ with set/get methods. In main method create objects of ‘Account’ and test these properties and
print the results on the screen.
1
2012-10-02T07:42:43-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Account
{
& int id;
& string name;
& private int no_account;
& public void setNoAcc(int a) { no_account = a; }
& private int IntRate;
& public int getIntRate() { return IntRate; }
& private int password;
& public void setPass(int p) { password = p; }
& int branch;
& public void setBranch(int b) { branch = b; }
& public int getBranch() { return branch; }
}
class Program
{
& static void Main(string[] args)
& {
Account ac = new Account();
ac.setBranch(1);
Console.WriteLine(ac.getBranch());
ac.setNoAcc(12);
Console.WriteLine(ac.getIntRate());
ac.setPass(1123);
& }
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C#
Comments
Leave a comment