bai tap c# sinh vien
ho ten
ngay sinh
lop
diem toan
diem tin
tong diem
danh sach sinh vien
danh sach thi lai
thuc hien ket thuc
form1.cs
namespace Class_sinh_vien
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label4_Click(object sender, EventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
private void label6_Click(object sender, EventArgs e)
{
}
private void label7_Click(object sender, EventArgs e)
{
}
private void label8_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
sinh_vien sv = new sinh_vien();
sv.hoten = string.Intern(ho_ten.Text);
sv.lophoc = string.Intern(lop_hoc.Text);
sv.ngaysinh = string.Intern(ngay_sinh.Text);
diem_sinh_vien dsv = new diem_sinh_vien();
dsv.dtin = float.Parse(d_tin.Text);
dsv.dtoan = float.Parse(d_toan.Text);
tong_diem.Text = dsv.tongdiem().ToString();
danh_sach.Text += "ho ten: " + sv.hoten.ToString() + "
" + "ngay sinh: " + sv.ngaysinh.ToString() + "
" + "lop: " + sv.lophoc.ToString() + "
" + "diem toan: " + dsv.dtoan.ToString() + "
" + "diem tin: " + dsv.dtin.ToString() + "
"+"tong diem: "+tong_diem.Text+"
";
if (dsv.dtin < 5 || dsv.dtoan < 5)
danh_sach_thi_lai.Text += sv.hoten.ToString()+"
";
}
}
}
diem sinh vien.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Class_sinh_vien
{
class diem_sinh_vien
{
private float d_toan;
private float d_tin;
private float tong_diem;
public float dtoan
{
get { return d_toan; }
set { d_toan = value; }
}
public float dtin
{
get { return d_tin; }
set { d_tin = value; }
}
public float tongdiem()
{
tong_diem = d_toan+d_tin;
return tong_diem;
}
}
}
sinh vien.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Class_sinh_vien
{
class sinh_vien
{
private string ho_ten;
private string ngay_sinh;
private string lop_hoc;
public string hoten
{
get { return ho_ten; }
set { ho_ten = value; }
}
public string ngaysinh
{
get { return ngay_sinh; }
set { ngay_sinh = value; }
}
public string lophoc
{
get { return lop_hoc; }
set { lop_hoc = value; }
}
}
}
program.cs giu nguyen
Bạn đang đọc truyện trên: Truyen247.Pro