Challenge Answers
Bronze
class Netflix {
//Properties
public string Name { get; set; }
public double Rating { get; set; }
public string Genre { get; set; }
}
class Program {
public void Main(string[] args) {
Netflix show1 = new Netflix();
show1.Name = "Hello World!";
show1.Rating = 4.0;
show1.Genre = "Kid's Shows";
Netflix show2 = new Netflix();
show2.Name = "Hello World! 2";
show2.Rating = 3.0;
show2.Genre = "Dark Comedy";
Netflix show3 = new Netflix();
show3.Name = "Hello World!: The Movie";
show3.Rating = 4.5;
show3.Genre = "All Audiences";
show1.GetSuggestion();
show2.GetSuggestion();
show3.GetSuggestion();
printMovies();
}
}
}
Silver
class Netflix {
public void GetSuggestion()
{
if (this.Rating >= 4) {
Console.WriteLine("You definitely need to watch this show");
Console.ReadLine();
} else {
Console.WriteLine("You probably won't want to watch this show");
Console.ReadLine();
}
}
}
class Main(string[] args) {
show1.getSuggestion();
show2.getSuggestion();
show3.getSuggestion();
}
Gold
class Netflix {
public void printMovies() {
foreach(Netflix movie in movieList) {
Console.WriteLine("Name: {0}, Rating: {1}, Genre: {2}", show.Name, show.Rating, show.Genre);
}
Console.ReadLine();
}
}
class Main(string[] args) {
List<Netflix> movieList = new List<Netflix>();
movieList.Add(show1);
movieList.Add(show2);
movieList.Add(show3);
printMovies();
}
Last updated