Professional Documents
Culture Documents
Thu C Tính: Lab 2: Bài 1
Thu C Tính: Lab 2: Bài 1
MSSV: 20200156
Lớp: 20DVT
namespace Lab2
{
class Program
{
static void Main(string[] args)
{
UserInformation user1 = new UserInformation("A", 16, 900);
Console.WriteLine(user1.ToString());
Console.ReadLine();
}
}
internal class UserInformation
{
1
Báo cáo thực hành – Kỹ thuật lập trình nâng cao
{
userID = value;
}
else
Console.WriteLine("Error! ID must be between 1000 and 9999");
}
}
public UserInformation(string userName, int age, uint id)
{
UserName = userName;
UserAge = age;
UserID = id;
}
}
}
Bài 2
Code
2
Báo cáo thực hành – Kỹ thuật lập trình nâng cao
namespace Lab2
{
class Program
{
static void Main()
{
BankAccount user1 = new BankAccount("ale", 20, 1111, 1000, "123");
if (isPasswordVerified)
{
Console.ReadKey();
}
}
class BankAccount
{
private string password;
private double balance;
private bool isPasswordVerified;
private UserInformation userInf;
3
Báo cáo thực hành – Kỹ thuật lập trình nâng cao
public BankAccount(string userName, int userAge, uint userID, double balance, string password)
{
userInf = new UserInformation(userName, userAge, userID);
this.password = password;
this.balance = balance;
isPasswordVerified = false;
}
4
Báo cáo thực hành – Kỹ thuật lập trình nâng cao
}
}
}
}
}
}
5
Báo cáo thực hành – Kỹ thuật lập trình nâng cao