Week02 - Lab - Pet: Using Using Using Using Using
Week02 - Lab - Pet: Using Using Using Using Using
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/*Name: Mel Vincent Anonuevo
*SIN: 301167069
*Date: Sept 21, 2021
*/
namespace Week02_Lab_Pet
{
class Program
{
static void Main(string[] args)
{
};
pets[0].SetOwner("Mel");
pets[1].SetOwner("Trisha");
pets[2].SetOwner("Trisha");
pets[0].Train();
pets[2].Train();
Console.WriteLine("All pets:");
foreach (var Pets in pets)
{
Console.WriteLine($" - {Pets}");
}
Console.WriteLine();
Console.Write("Please enter the name of the owner to see which pets they own:
");
string owner = Console.ReadLine();
Console.WriteLine($"These pets are owned by {owner}");
foreach (Pets pet in pets)
{
if (pet.Owner == owner)
Console.WriteLine($" - {pet}");
}
}
}
}
class Pets
{
public string Name { get; }
public string Owner { get; private set; }
public int Age { get; }
public string Description { get; }
public bool IsHouseTrained { get; private set; }
Owner = owner;
}
}
}
Week02_Lab_Medal
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/*Name: Mel Vincent Anonuevo
*SIN: 301167069
*Date: Sept 19, 2021
*/
namespace Week02_Lab_Medal
{
class Program
{
static void Main(string[] args)
{
}
/*foreach (var Medal in medals)
{
Console.WriteLine($"{Medal.Name}({MedalColor.Gold})");
}*/
}
writer.Close();
public Medal(string name, string theEvent, MedalColor color, int year, bool
isRecord)
{
Name = name;
TheEvent = theEvent;
Color = color;
Year = year;
IsRecord = isRecord;
}