//2.Write a method that determines a student’s grade. The method will read three types of //scores(quiz score, mid-term score, and final score) and determine the grade based on //the following rules: static private string GetStudentsGrade() { int grade1; int grade2; int grade3; int AverageGrade; Console.WriteLine("Please enter the quiz score (0-100):"); int.TryParse(Console.ReadLine(), out grade1); Console.WriteLine(""); Console.WriteLine("Please enter the mid-term score (0-100):"); int.TryParse(Console.ReadLine(), out grade2); Console.WriteLine(""); Console.WriteLine("Please enter the final score (0-100):"); int.TryParse(Console.ReadLine(), out grade3); Console.WriteLine(""); AverageGrade = (grade1 + grade2 + grade3) / 3; Console.WriteLine("The average grade is:" + AverageGrade.ToString()); Console.WriteLine("--------------------------------------------------"); if (AverageGrade == 90) { Console.WriteLine("Your final grade is: Grade A"); return("Grade A"); } else if ((AverageGrade >= 70) && (AverageGrade < 90)) { Console.WriteLine("Your final grade is: Grade B"); return("Grade B"); } else if ((AverageGrade >= 50) && (AverageGrade < 70)) { Console.WriteLine("Your final grade is: Grade C"); return("Grade C"); } else if (AverageGrade < 50) { Console.WriteLine("Your final grade is: Grade F"); return("Grade F"); } else { Console.WriteLine("Not any grade applicable"); return("Not any grade applicable"); }; }
private void avgScore_ItemClicked(object sender, EventArgs e) { AverageGrade avg = new AverageGrade(); avg.Show(); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (ActivityType != null) { hashCode = hashCode * 59 + ActivityType.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } if (AverageGrade != null) { hashCode = hashCode * 59 + AverageGrade.GetHashCode(); } if (MaximumGrade != null) { hashCode = hashCode * 59 + MaximumGrade.GetHashCode(); } if (ElevationHigh != null) { hashCode = hashCode * 59 + ElevationHigh.GetHashCode(); } if (ElevationLow != null) { hashCode = hashCode * 59 + ElevationLow.GetHashCode(); } if (StartLatlng != null) { hashCode = hashCode * 59 + StartLatlng.GetHashCode(); } if (EndLatlng != null) { hashCode = hashCode * 59 + EndLatlng.GetHashCode(); } if (ClimbCategory != null) { hashCode = hashCode * 59 + ClimbCategory.GetHashCode(); } if (City != null) { hashCode = hashCode * 59 + City.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (Country != null) { hashCode = hashCode * 59 + Country.GetHashCode(); } if (_Private != null) { hashCode = hashCode * 59 + _Private.GetHashCode(); } if (AthletePrEffort != null) { hashCode = hashCode * 59 + AthletePrEffort.GetHashCode(); } if (AthleteSegmentStats != null) { hashCode = hashCode * 59 + AthleteSegmentStats.GetHashCode(); } return(hashCode); } }
public int CompareTo(Student obj) { return(AverageGrade.CompareTo(obj.AverageGrade)); }
/// <summary> /// Returns true if SummarySegment instances are equal /// </summary> /// <param name="other">Instance of SummarySegment to be compared</param> /// <returns>Boolean</returns> public bool Equals(SummarySegment other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( ActivityType == other.ActivityType || ActivityType != null && ActivityType.Equals(other.ActivityType) ) && ( Distance == other.Distance || Distance != null && Distance.Equals(other.Distance) ) && ( AverageGrade == other.AverageGrade || AverageGrade != null && AverageGrade.Equals(other.AverageGrade) ) && ( MaximumGrade == other.MaximumGrade || MaximumGrade != null && MaximumGrade.Equals(other.MaximumGrade) ) && ( ElevationHigh == other.ElevationHigh || ElevationHigh != null && ElevationHigh.Equals(other.ElevationHigh) ) && ( ElevationLow == other.ElevationLow || ElevationLow != null && ElevationLow.Equals(other.ElevationLow) ) && ( StartLatlng == other.StartLatlng || StartLatlng != null && StartLatlng.Equals(other.StartLatlng) ) && ( EndLatlng == other.EndLatlng || EndLatlng != null && EndLatlng.Equals(other.EndLatlng) ) && ( ClimbCategory == other.ClimbCategory || ClimbCategory != null && ClimbCategory.Equals(other.ClimbCategory) ) && ( City == other.City || City != null && City.Equals(other.City) ) && ( State == other.State || State != null && State.Equals(other.State) ) && ( Country == other.Country || Country != null && Country.Equals(other.Country) ) && ( _Private == other._Private || _Private != null && _Private.Equals(other._Private) ) && ( AthletePrEffort == other.AthletePrEffort || AthletePrEffort != null && AthletePrEffort.Equals(other.AthletePrEffort) ) && ( AthleteSegmentStats == other.AthleteSegmentStats || AthleteSegmentStats != null && AthleteSegmentStats.Equals(other.AthleteSegmentStats) )); }