[Examination] C# - Chương trình quản lý đội thi TechWiz toàn cầu Apptech Ấn Độ - C#
Trong cuộc thi Techwiz toàn cầu do Aptech Ấn Độ tổ chức. Có rất nhiều các đội ở các trung tâm Aptech trên toàn cầu cùng tham gia. Bạn được yêu cầu viết chương trình quản lý thông tin đội chơi và thông tin dự án của từng đội.
Yêu cầu:
1) Tạo lớp đối tượng Project gồm các trường thông tin: string name (tên đề tài), string projectType: Nhóm dự án (group chỉ nhận 3 giá trị là Development & Design Website, Website Developer, Application Developer) - 1 điểm
2) Tạo lớp đối tượng Group gồm các thuộc tính: string name (tên nhóm), string center: tên trung tâm aptech, project (kiểu dữ liệu là Project) - 1 điểm
Viết getter/setter cho tất cả các thuộc tính của lớp đối tượng - 1 điểm
Viết hàm Input, Display của đối tượng trên - 2 điểm
Tạo class Program có chưa 1 method Main. Yêu cầu khai báo mảng List<Group> groupList. Yêu cầu nhập vào ngẫu nhiên N nhóm (N có giá trị từ 2 tới 10) - 5 điểm
Tạo 1 delegate như sau
delegate void ShowInfor();
Khai báo 1 đối tượng delegate ShowInfor -> Thực hiện quản lý tất cả các phương thức Display() của tất cả các đối tượng Project trong đối tượng này. Yêu cầu gọi thực thi delegate vừa được tạo ra. - 5 điểm
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)
![Bùi Văn Mạnh [T2008A]](https://www.gravatar.com/avatar/17e9c94870c94e61c9203ee31dccf01c.jpg?s=80&d=mm&r=g)
Bùi Văn Mạnh
2021-06-04 09:26:27
using System;
using System.Collections.Generic;
namespace TechWiz
{
class Program
{
public delegate void showInfor();
static void Main(string[] args)
{
List<showInfor> list = new List<showInfor>();
List<Group> groupList = new List<Group>();
Console.WriteLine("so nhom:");
int N = int.Parse(Console.ReadLine());
for (int i = 1; i <= N; i++)
{
Group group = new Group();
group.Input();
groupList.Add(group);
list.Add(group.project.Display);
}
foreach (showInfor s in list)
{
s();
}
}
}
}
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2021-06-04 09:25:10
https://res.cloudinary.com/wegoup/image/upload/v1622798702/ayxqfmyhlapkcrng2eej.png
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2021-06-04 09:24:44
using System;
using System.Collections.Generic;
namespace quanlithongtin
{
class Program
{
public delegate void ShowInfor();
static List<Group> groupList = new List<Group>();
static void Main(string[] args)
{
Console.WriteLine("Nhap ngau nhien N nhom: ");
int n = Int32.Parse(Console.ReadLine());
if (n < 2 || n > 10)
{
Console.WriteLine("N co gia tri tu 2 den 10");
}
for (int i = 0; i < n; i++)
{
Console.WriteLine("Nhap thong tin nhom:");
Group group = new Group();
group.input();
groupList.Add(group);
}
Console.WriteLine("Danh sach cac nhom: ");
foreach (Group gr in groupList)
{
gr.display();
}
}
}
}
![vuong huu phu [T2008A]](https://www.gravatar.com/avatar/307a5cf29780afab49706dc8b15b86c6.jpg?s=80&d=mm&r=g)
vuong huu phu
2021-06-04 09:24:16
#Screenshot (26).png
https://res.cloudinary.com/wegoup/image/upload/v1622798625/svzvoxa04lgrwzbghj88.png
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2021-06-04 09:24:15
using System;
using System.Collections.Generic;
using System.Text;
namespace quanlithongtin
{
class Group
{
public string name { get; set; }
public string center { get; set; }
public string project { get; set; }
public Group() { }
public Group( string name, string center, string project)
{
this.name = name;
this.center = center;
this.project = project;
}
public void input()
{
Console.WriteLine("nhap ten nhom: ");
string name = Console.ReadLine();
Console.WriteLine("nhap ten trung tam: ");
string center = Console.ReadLine();
Console.WriteLine("nhap ten du an: ");
string project = Console.ReadLine();
}
public void display()
{
Console.WriteLine("ten nhom: {0}, ten trung tam: {1}, ten du an: {2}", name, center, project);
}
}
}
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2021-06-04 09:23:58
using System;
using System.Collections.Generic;
using System.Text;
namespace quanlithongtin
{
class Project
{
public string name { get; set; }
public string group { get; set; }
public Project(){ }
public Project(string name, string group)
{
this.name = name;
this.group = group;
}
public void input()
{
Console.WriteLine("nhap ten de tai: ");
string name = Console.ReadLine();
Console.WriteLine("nhap nhom du an: ");
string group = Console.ReadLine();
}
public void display()
{
Console.WriteLine("ten de tai: {0}, group: {1}", name, group);
}
}
}
![Đặng Trần Nhật Minh [T2008A]](https://www.gravatar.com/avatar/ee8dc5a777ad26f3a962e86c233437cf.jpg?s=80&d=mm&r=g)
Đặng Trần Nhật Minh
2021-06-04 09:23:06
using System;
using System.Collections.Generic;
using System.Text;
namespace Exam
{
class Group
{
public string Name { get; set; }
public string Center { get; set; }
public List<Project> proList { get; set; }
public Group()
{
proList = new List<Project>();
}
public Group(string Name, string Center)
{
this.Name = Name;
this.Center = Center;
}
public void input()
{
Console.WriteLine("Name: ");
Name = Console.ReadLine();
Console.WriteLine("Centre: ");
Center = Console.ReadLine();
public void inputProject(List<Project> proList)
{
Project project = new Project();
project.input();
proList.Add(project);
}
}
public void display()
{
Console.WriteLine("Name: {0}, Centre: {1}", Name, Center);
foreach (Project project in proList)
{
project.display();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Exam
{
class Project
{
public string Name { get; set; }
public string Group { get; set; }
public Project()
{
}
public Project(string Name, string Group)
{
this.Name = Name;
this.Group = Group;
}
public void input()
{
Console.WriteLine("Name: ");
Name = Console.ReadLine();
Console.WriteLine("Pick a Group:");
Console.WriteLine("1. Development & Design Website");
Console.WriteLine("2. Website Developer");
Console.WriteLine("3. Application Developer");
int choose = Convert.ToInt32(Console.ReadLine());
switch(choose)
{
case 1:
Group = "Development & Design Website";
break;
case 2:
Group = "Website Developer";
break;
case 3:
Group = "Application Developer";
break;
default:
Console.WriteLine("WRONG INPUT");
break;
}
}
public void display()
{
Console.WriteLine("Name: {0}, Group: {1}", Name, Group);
}
}
}
![vuong huu phu [T2008A]](https://www.gravatar.com/avatar/307a5cf29780afab49706dc8b15b86c6.jpg?s=80&d=mm&r=g)
vuong huu phu
2021-06-04 09:23:06
using System;
using System.Collections.Generic;
namespace baithi
{
class Program
{
public delegate void showInfor();
public static List<Group> groupList = new List<Group>();
static void Main(string[] args)
{
Console.WriteLine("Nhap n nhom ");
int n;
Console.WriteLine("Nhap so n ");
int n1 = Int32.Parse(Console.ReadLine());
while (true) {
if (n1 > 2 && n1 <= 10)
{
n = n1;
}
else {
Console.WriteLine("Nhap lai n ");
n1 = Int32.Parse(Console.ReadLine());
}
}
for (int i = 0; i < n; i++) {
Group g = new Group();
g.input();
groupList.Add(g);
}
display();
}
public static void display() {
foreach (Group g in groupList) {
g.display();
}
}
}}
using System;
using System.Collections.Generic;
using System.Text;
namespace baithi
{
class Project
{
public String name { set; get; }
public String group {
get {
return group;
}
set {
if (value == "Development & Design Website")
{
group = value;
}
else if (value == "Website Developer")
{
group = value;
}
else if (value == "Application Developer")
{
group = value;
}
else {
throw new Exception("nhom de tai khong dung");
}
}
}
public Project() { }
public void nhap() {
Console.WriteLine(" Nhap ten de tai ");
name = Console.ReadLine();
Console.WriteLine("Nhap ten nhom du an ");
group = Console.ReadLine();
}
public void display() {
Console.WriteLine("Ten de tai" + name + " Nhom du an" + g);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace baithi
{
class Group
{
public string ten { set; get; }
public String center { set; get; }
public Project project { set; get; }
public void input() {
project = new Project();
Console.WriteLine("Nhap ten");
ten = Console.ReadLine();
Console.WriteLine("Nhap trung tam ");
center = Console.ReadLine();
project.nhap();
}
public void display() {
Console.WriteLine("Ten nhom :" + ten + " Ten trung tam : " + center + "Ten de tai" + project.name + "Ten du an" + project.group);
}
}
}
![Do Trung Duc [T2008A]](https://www.gravatar.com/avatar/2973ac07124f066b4605c535e8d39a99.jpg?s=80&d=mm&r=g)
Do Trung Duc
2021-06-04 09:21:35
using System;
using System.Collections.Generic;
namespace ExamFinal
{
class Program
{
public delegate void ShowInfor();
static List<Group> ListGroup = new List<Group>();
static void Main(string[] args)
{
Console.WriteLine("Nhap so luong nhom muon them:");
int N = Int32.Parse(Console.ReadLine());
for(int i = 0; i < N; i++)
{
Console.WriteLine("Nhap thong tin nhom thu {0}", i + 1);
Group group = new Group();
group.Input();
ListGroup.Add(group);
}
Console.WriteLine("Thong tin tat ca cac du an tham gia du thi nhu sau:");
ShowInfor showInfor = new ShowInfor(DisplayAllProject);
showInfor();
}
static void DisplayAllProject()
{
foreach(Group group in ListGroup)
{
group.Project.Display();
}
}
}
}
![Triệu Văn Lăng [T2008A]](https://www.gravatar.com/avatar/1348e3562c6492c26f796cb1f45982a1.jpg?s=80&d=mm&r=g)
Triệu Văn Lăng
2021-06-04 09:21:35
#lythuyet