Created
March 19, 2014 00:11
-
-
Save Bocom/9632908 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace SomeAssignment | |
| { | |
| public class ProfessorRating | |
| { | |
| public int Id | |
| { | |
| get; | |
| private set; | |
| } | |
| public int Easiness { get; set; } | |
| public int Helpfulness { get; set; } | |
| public int Clarity { get; set; } | |
| public ProfessorRating(int id) : this(id, 0, 0, 0) { } | |
| public ProfessorRating(int id, int easiness, int helpfulness, int clarity) | |
| { | |
| Id = id; | |
| Easiness = easiness; | |
| Helpfulness = helpfulness; | |
| Clarity = clarity; | |
| } | |
| public double GetRatingAverage() | |
| { | |
| return Math.Round((Easiness + Helpfulness + Clarity) / 3f); | |
| } | |
| } | |
| public class Implementation | |
| { | |
| public Implementation() | |
| { | |
| var prof = new ProfessorRating(0); | |
| Console.WriteLine("Enter professor easiness"); | |
| prof.Easiness = int.Parse(Console.ReadLine()); | |
| Console.WriteLine("Enter professor helpfulness"); | |
| prof.Helpfulness = int.Parse(Console.ReadLine()); | |
| Console.WriteLine("Enter professor clarity"); | |
| prof.Clarity = int.Parse(Console.ReadLine()); | |
| Console.WriteLine(); | |
| Console.WriteLine("Easiness: " + prof.Easiness); | |
| Console.WriteLine("Helpfulness: " + prof.Helpfulness); | |
| Console.WriteLine("Clarity: " + prof.Clarity); | |
| Console.WriteLine("Average rating: " + prof.GetRatingAverage()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment