Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class QBR
- {
- public static void Main()
- {
- start:
- string Completions, Attempts, Touchdowns, Interceptions, Yards;
- double completions, attempts, touchdowns, interceptions, yards;
- Console.Write("Completions: ");
- Completions = Console.ReadLine();
- double.TryParse(Completions, out completions);
- Console.Write("Attempts: ");
- Attempts = Console.ReadLine();
- double.TryParse(Attempts, out attempts);
- Console.Write("Touchdowns: ");
- Touchdowns = Console.ReadLine();
- double.TryParse(Touchdowns, out touchdowns);
- Console.Write("Interceptions: ");
- Interceptions = Console.ReadLine();
- double.TryParse(Interceptions, out interceptions);
- Console.Write("Yards: ");
- Yards = Console.ReadLine();
- double.TryParse(Yards, out yards);
- double a, b, c, d, rating, finalrating;
- a = (((completions / attempts) * 100) - 30) / 20.0;
- b = ((touchdowns / attempts) * 100) / 5.0;
- c=(9.5-((interceptions/attempts)*100))/4.0;
- d=((yards/attempts)-3)/4.0;
- rating = ((a+b+c+d)/6.0)*100;
- finalrating = Math.Round(rating, 1);
- if (finalrating > 158.3)
- {
- Console.WriteLine("Error: Invalid Data");
- goto start;
- }
- if (finalrating < 0)
- {
- Console.WriteLine("Error: Invalid Data");
- goto start;
- }
- else
- {
- Console.WriteLine("Quarterback Rating: {0}", finalrating);
- goto start;
- }
- }
- }
Add Comment
Please, Sign In to add comment