0% found this document useful (0 votes)
14 views5 pages

C# Oop

Uploaded by

tuandq.22ite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

C# Oop

Uploaded by

tuandq.22ite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lap 1

using System;

class Dice

private int sides;

public Dice(int sides)

[Link] = sides;

public int Roll()

Random random = new Random();

return [Link](1, sides + 1);

class Program
{

static void Main()

[Link]("Nhap so mat cua xuc xac: ");

int sides = [Link]([Link]());

Dice dice = new Dice(sides);

int ketQua = [Link]();

[Link]("Ket qua lan tung xuc xac: " + ketQua);

[Link]();

Lap 3

using System;

using [Link];

class Song
{

public string TypeList { get; set; }

public string Name { get; set; }

public string Time { get; set; }

public Song(string typeList, string name, string time)

TypeList = typeList;

Name = name;

Time = time;

class Program

static void Main()

int n = [Link]([Link]());

List<Song> songs = new List<Song>();

for (int i = 0; i < n; i++)

string[] songData = [Link]().Split('_');

string typeList = songData[0];

string name = songData[1];

string time = songData[2];


Song song = new Song(typeList, name, time);

[Link](song);

string filterType = [Link]();

foreach (var song in songs)

if (filterType == "all" || [Link] == filterType)

[Link]([Link]);

You might also like