Advertisement
Tidall

Grade Calc Source

Oct 20th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 30.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace GradeCalculatorConsole
  8. {
  9.  
  10.     class Program
  11.     {
  12.  
  13.         static string userChoice, choice, confirm;
  14.         static int choiceConfirm;
  15.         // 1 = gpa 0 = money 2 = exit
  16.  
  17.         static string standardchar, honorschar, apchar, stanclass2, stanclass3, stanclass4, honclass2, honclass3, honclass4, apclass1, apclass2, apclass3, apclass4;
  18.         static int standard, honors, ap;
  19.  
  20.         static string stanclass1, honclass1;
  21.  
  22.         static string rgrade1, rgrade2, rgrade3, rgrade4;
  23.  
  24.         static int agrade, bgrade, cgrade, dgrade, fgrade;
  25.  
  26.         static void Main(string[] args)
  27.         {
  28.             Process();
  29.         }
  30.  
  31.         static void Process()
  32.         {
  33.             Console.Clear();
  34.             showWelcomeMessage();
  35.             gorm();
  36.             consoleNoClose();
  37.         }
  38.  
  39.         #region menu
  40.  
  41.         static void showWelcomeMessage()
  42.         {
  43.             Console.WriteLine(" =========================================================");
  44.             Console.WriteLine("||    _____         _          _____           _         ||");
  45.             Console.WriteLine("||   |__   |___ ___| |_ ___   |   __|___ ___ _| |___     ||");
  46.             Console.WriteLine("||   |   __| .'|  _|   |_ -|  |  |  |  _| .'| . | -_|    ||");
  47.             Console.WriteLine("||   |_____|__,|___|_|_|___|  |_____|_| |__,|___|___|    ||");
  48.             Console.WriteLine("||                                                       ||");
  49.             Console.WriteLine("||         _____     _         _     _                   ||");
  50.             Console.WriteLine("||        |     |___| |___ _ _| |___| |_ ___ ___         ||");
  51.             Console.WriteLine("||        |   --| .'| |  _| | | | .'|  _| . |  _|        ||");
  52.             Console.WriteLine("||        |_____|__,|_|___|___|_|__,|_| |___|_|          ||");
  53.             Console.WriteLine("||                                                       ||");
  54.             Console.WriteLine(" =========================================================");
  55.             Console.WriteLine();
  56.             Console.WriteLine("=======================================");
  57.             Console.WriteLine("Welcome to Zach's Grade Calculator V2");
  58.             Console.WriteLine("=======================================");
  59.             Console.WriteLine();
  60.         }
  61.  
  62.         static void gorm()
  63.         {
  64.             Console.WriteLine("What would you like to do?");
  65.             Console.WriteLine();
  66.             Console.WriteLine("Type GPA for a GPA Calculator.");
  67.             Console.WriteLine("Type MONEY for a money calculator.");
  68.             Console.WriteLine("Type EXIT to exit the calculator.");
  69.             Console.WriteLine("=======================================");
  70.             userChoice = Console.ReadLine();
  71.  
  72.             userChoice = userChoice.ToUpper();
  73.             Console.WriteLine(userChoice);
  74.  
  75.             switch (userChoice)
  76.             {
  77.                 case "GPA":
  78.                     choiceConfirm = 1;
  79.                     choice = "GPA Calculator";
  80.                     break;
  81.                 case "MONEY":
  82.                     choiceConfirm = 0;
  83.                     choice = "Money Calculator";
  84.                     break;
  85.                 case "EXIT":
  86.                     choiceConfirm = 2;
  87.                     choice = "EXIT";
  88.                     break;
  89.                 default:
  90.                     Console.WriteLine("Invalid choice, reenter.");
  91.                     Console.WriteLine("=======================================");
  92.                     gorm();
  93.                     break;
  94.             }
  95.  
  96.             confirmChoice();
  97.  
  98.         }
  99.  
  100.         static void confirmChoice()
  101.         {
  102.             Console.WriteLine("=======================================");
  103.             Console.WriteLine("You chose: {0}.", choice);
  104.             Console.WriteLine();
  105.             Console.WriteLine("Confirm your choice Y/N:");
  106.             Console.WriteLine("=======================================");
  107.             confirm = Console.ReadLine();
  108.  
  109.             confirm = confirm.ToUpper();
  110.             confirm.ToUpper();
  111.  
  112.             if (confirm == "Y")
  113.             {
  114.                 if (choiceConfirm == 1)
  115.                 {
  116.                     gpaCalculate();
  117.                 }
  118.                 else if (choiceConfirm == 0)
  119.                 {
  120.                     moneyCalculate();
  121.                 }
  122.                 else if (choiceConfirm == 2)
  123.                 {
  124.                     System.Environment.Exit(0);
  125.  
  126.                 }
  127.  
  128.             }
  129.             else if (confirm == "N")
  130.             {
  131.                 gorm();
  132.             }
  133.             else
  134.             {
  135.                 Console.WriteLine();
  136.                 Console.WriteLine("Error: Invalid Format reenter");
  137.                 confirmChoice();
  138.             }
  139.  
  140.         }
  141.  
  142.         #endregion
  143.  
  144.         #region gpa
  145.  
  146.         static void gpaCalculate()
  147.         {
  148.             Console.Clear();
  149.             Console.WriteLine();
  150.             Console.WriteLine("GPA Calculator Initialized");
  151.             Console.WriteLine("=======================================");
  152.             Console.WriteLine("This is calculated using the weighted gpa system:");
  153.             Console.WriteLine("Standard A = 4 | Honors A = 4.5 | AP A = 5");
  154.             Console.WriteLine("Standard B = 3 | Honors B = 3.5 | AP B = 4");
  155.             Console.WriteLine("Standard C = 2 | Honors C = 2.5 | AP C = 3");
  156.             Console.WriteLine("Standard D = 1 | Honors D = 1.5 | AP D = 2");
  157.             Console.WriteLine("Standard F = 0 | Honors F = 0.5 | AP F = 1");
  158.             Console.WriteLine("=======================================");
  159.             Console.WriteLine("Currently only supports 1 semester of 4 block classes");
  160.             Console.WriteLine("=======================================");
  161.  
  162.             getGrades();
  163.  
  164.             double points = getGradePoints();
  165.  
  166.             int classnum = standard + honors + ap;
  167.  
  168.             double gpa = points / classnum;
  169.  
  170.             Console.WriteLine();
  171.             Console.WriteLine("=======================================");
  172.             Console.WriteLine("Your GPA has been Calculated!");
  173.             Console.WriteLine("=======================================");
  174.             Console.WriteLine("Your single semester GPA is: {0}", gpa);
  175.             Console.WriteLine();
  176.             Console.WriteLine("Press any key to return to the menu.");
  177.             Console.ReadKey();
  178.  
  179.             Process();
  180.         }
  181.  
  182.         static void getGrades()
  183.         {
  184.             //throws FormatException if char is entered
  185.  
  186.             stanclass1 = "";
  187.             stanclass2 = "";
  188.             stanclass3 = "";
  189.             stanclass4 = "";
  190.             honclass1 = "";
  191.             honclass2 = "";
  192.             honclass3 = "";
  193.             honclass4 = "";
  194.             apclass1 = "";
  195.             apclass2 = "";
  196.             apclass3 = "";
  197.             apclass4 = "";
  198.  
  199.             try
  200.             {
  201.  
  202.                 Console.WriteLine("How many grade level classes are you taking?");
  203.                 standardchar = Console.ReadLine();
  204.                 standard = int.Parse(standardchar);
  205.                 Console.WriteLine();
  206.  
  207.                 Console.WriteLine("How many honors level classes are you taking?");
  208.                 honorschar = Console.ReadLine();
  209.                 honors = int.Parse(honorschar);
  210.                 Console.WriteLine();
  211.  
  212.                 Console.WriteLine("How many AP level classes are you taking?");
  213.                 apchar = Console.ReadLine();
  214.                 ap = int.Parse(apchar);
  215.                 Console.WriteLine();
  216.             }
  217.             catch (FormatException)
  218.             {
  219.                 Console.WriteLine("ERROR:");
  220.                 Console.WriteLine("You have input an incorrect character, retry. You will need to reneter grades.");
  221.                 getGrades();
  222.             }
  223.  
  224.  
  225.             int i = 1;
  226.  
  227.             while (i <= standard)
  228.             {
  229.  
  230.                 Console.WriteLine("Enter letter grade for grade level class {0}", i);
  231.  
  232.                 if (i == 1)
  233.                 {
  234.                     stanclass1 = Console.ReadLine();
  235.                 }
  236.                 else if (i == 2)
  237.                 {
  238.                     stanclass2 = Console.ReadLine();
  239.                 }
  240.                 else if (i == 3)
  241.                 {
  242.                     stanclass3 = Console.ReadLine();
  243.                 }
  244.                 else if (i == 4)
  245.                 {
  246.                     stanclass4 = Console.ReadLine();
  247.                 }
  248.                 else
  249.                 {
  250.                     break;
  251.                 }
  252.  
  253.                 i++;
  254.             }
  255.  
  256.             i = 1;
  257.  
  258.             while (i <= honors)
  259.             {
  260.                 Console.WriteLine("Enter letter grade for honors level class {0}", i);
  261.  
  262.                 if (i == 1)
  263.                 {
  264.                     honclass1 = Console.ReadLine();
  265.                 }
  266.                 else if (i == 2)
  267.                 {
  268.                     honclass2 = Console.ReadLine();
  269.                 }
  270.                 else if (i == 3)
  271.                 {
  272.                     honclass3 = Console.ReadLine();
  273.                 }
  274.                 else if (i == 4)
  275.                 {
  276.                     honclass4 = Console.ReadLine();
  277.                 }
  278.                 else
  279.                 {
  280.                     break;
  281.                 }
  282.                 i++;
  283.             }
  284.  
  285.             i = 1;
  286.  
  287.             while (i <= ap)
  288.             {
  289.                 Console.WriteLine("Enter Letter grade for AP level class {0}", i);
  290.  
  291.                 if (i == 1)
  292.                 {
  293.                     apclass1 = Console.ReadLine();
  294.                 }
  295.                 else if (i == 2)
  296.                 {
  297.                     apclass2 = Console.ReadLine();
  298.                 }
  299.                 else if (i == 3)
  300.                 {
  301.                     apclass3 = Console.ReadLine();
  302.                 }
  303.                 else if (i == 4)
  304.                 {
  305.                     apclass4 = Console.ReadLine();
  306.                 }
  307.                 else
  308.                 {
  309.                     break;
  310.                 }
  311.                 i++;
  312.             }
  313.  
  314.         }
  315.  
  316.         static double getGradePoints() //change back to a double return
  317.         {
  318.             double total = 0.0;
  319.  
  320.             #region stan
  321.  
  322.             switch (stanclass1)
  323.             {
  324.                 case "A":
  325.                     total = total + 4.0;
  326.                     break;
  327.                 case "a":
  328.                     total = total + 4.0;
  329.                     break;
  330.                 case "B":
  331.                     total = total + 3.0;
  332.                     break;
  333.                 case "b":
  334.                     total = total + 3.0;
  335.                     break;
  336.                 case "C":
  337.                     total = total + 2.0;
  338.                     break;
  339.                 case "c":
  340.                     total = total + 2.0;
  341.                     break;
  342.                 case "D":
  343.                     total = total + 1.0;
  344.                     break;
  345.                 case "d":
  346.                     total = total + 1.0;
  347.                     break;
  348.                 case "F":
  349.                     total = total + 0.0;
  350.                     break;
  351.                 case "f":
  352.                     total = total + 0.0;
  353.                     break;
  354.                 default:
  355.                     break;
  356.             }
  357.  
  358.             switch (stanclass2)
  359.             {
  360.                 case "A":
  361.                     total = total + 4.0;
  362.                     break;
  363.                 case "a":
  364.                     total = total + 4.0;
  365.                     break;
  366.                 case "B":
  367.                     total = total + 3.0;
  368.                     break;
  369.                 case "b":
  370.                     total = total + 3.0;
  371.                     break;
  372.                 case "C":
  373.                     total = total + 2.0;
  374.                     break;
  375.                 case "c":
  376.                     total = total + 2.0;
  377.                     break;
  378.                 case "D":
  379.                     total = total + 1.0;
  380.                     break;
  381.                 case "d":
  382.                     total = total + 1.0;
  383.                     break;
  384.                 case "F":
  385.                     total = total + 0.0;
  386.                     break;
  387.                 case "f":
  388.                     total = total + 0.0;
  389.                     break;
  390.                 default:
  391.                     break;
  392.             }
  393.  
  394.             switch (stanclass3)
  395.             {
  396.                 case "A":
  397.                     total = total + 4.0;
  398.                     break;
  399.                 case "a":
  400.                     total = total + 4.0;
  401.                     break;
  402.                 case "B":
  403.                     total = total + 3.0;
  404.                     break;
  405.                 case "b":
  406.                     total = total + 3.0;
  407.                     break;
  408.                 case "C":
  409.                     total = total + 2.0;
  410.                     break;
  411.                 case "c":
  412.                     total = total + 2.0;
  413.                     break;
  414.                 case "D":
  415.                     total = total + 1.0;
  416.                     break;
  417.                 case "d":
  418.                     total = total + 1.0;
  419.                     break;
  420.                 case "F":
  421.                     total = total + 0.0;
  422.                     break;
  423.                 case "f":
  424.                     total = total + 0.0;
  425.                     break;
  426.                 default:
  427.                     break;
  428.             }
  429.  
  430.             switch (stanclass4)
  431.             {
  432.                 case "A":
  433.                     total = total + 4.0;
  434.                     break;
  435.                 case "a":
  436.                     total = total + 4.0;
  437.                     break;
  438.                 case "B":
  439.                     total = total + 3.0;
  440.                     break;
  441.                 case "b":
  442.                     total = total + 3.0;
  443.                     break;
  444.                 case "C":
  445.                     total = total + 2.0;
  446.                     break;
  447.                 case "c":
  448.                     total = total + 2.0;
  449.                     break;
  450.                 case "D":
  451.                     total = total + 1.0;
  452.                     break;
  453.                 case "d":
  454.                     total = total + 1.0;
  455.                     break;
  456.                 case "F":
  457.                     total = total + 0.0;
  458.                     break;
  459.                 case "f":
  460.                     total = total + 0.0;
  461.                     break;
  462.                 default:
  463.                     break;
  464.             }
  465.             #endregion
  466.  
  467.             #region hon
  468.  
  469.             switch (honclass1)
  470.             {
  471.                 case "A":
  472.                     total = total + 4.5;
  473.                     break;
  474.                 case "a":
  475.                     total = total + 4.5;
  476.                     break;
  477.                 case "B":
  478.                     total = total + 3.5;
  479.                     break;
  480.                 case "b":
  481.                     total = total + 3.5;
  482.                     break;
  483.                 case "C":
  484.                     total = total + 2.5;
  485.                     break;
  486.                 case "c":
  487.                     total = total + 2.5;
  488.                     break;
  489.                 case "D":
  490.                     total = total + 1.5;
  491.                     break;
  492.                 case "d":
  493.                     total = total + 1.5;
  494.                     break;
  495.                 case "F":
  496.                     total = total + 0.5;
  497.                     break;
  498.                 case "f":
  499.                     total = total + 0.5;
  500.                     break;
  501.                 default:
  502.                     break;
  503.             }
  504.  
  505.             switch (honclass2)
  506.             {
  507.                 case "A":
  508.                     total = total + 4.5;
  509.                     break;
  510.                 case "a":
  511.                     total = total + 4.5;
  512.                     break;
  513.                 case "B":
  514.                     total = total + 3.5;
  515.                     break;
  516.                 case "b":
  517.                     total = total + 3.5;
  518.                     break;
  519.                 case "C":
  520.                     total = total + 2.5;
  521.                     break;
  522.                 case "c":
  523.                     total = total + 2.5;
  524.                     break;
  525.                 case "D":
  526.                     total = total + 1.5;
  527.                     break;
  528.                 case "d":
  529.                     total = total + 1.5;
  530.                     break;
  531.                 case "F":
  532.                     total = total + 0.5;
  533.                     break;
  534.                 case "f":
  535.                     total = total + 0.5;
  536.                     break;
  537.                 default:
  538.                     break;
  539.             }
  540.  
  541.             switch (honclass3)
  542.             {
  543.                 case "A":
  544.                     total = total + 4.5;
  545.                     break;
  546.                 case "a":
  547.                     total = total + 4.5;
  548.                     break;
  549.                 case "B":
  550.                     total = total + 3.5;
  551.                     break;
  552.                 case "b":
  553.                     total = total + 3.5;
  554.                     break;
  555.                 case "C":
  556.                     total = total + 2.5;
  557.                     break;
  558.                 case "c":
  559.                     total = total + 2.5;
  560.                     break;
  561.                 case "D":
  562.                     total = total + 1.5;
  563.                     break;
  564.                 case "d":
  565.                     total = total + 1.5;
  566.                     break;
  567.                 case "F":
  568.                     total = total + 0.5;
  569.                     break;
  570.                 case "f":
  571.                     total = total + 0.5;
  572.                     break;
  573.                 default:
  574.                     break;
  575.             }
  576.  
  577.             switch (honclass4)
  578.             {
  579.                 case "A":
  580.                     total = total + 4.5;
  581.                     break;
  582.                 case "a":
  583.                     total = total + 4.5;
  584.                     break;
  585.                 case "B":
  586.                     total = total + 3.5;
  587.                     break;
  588.                 case "b":
  589.                     total = total + 3.5;
  590.                     break;
  591.                 case "C":
  592.                     total = total + 2.5;
  593.                     break;
  594.                 case "c":
  595.                     total = total + 2.5;
  596.                     break;
  597.                 case "D":
  598.                     total = total + 1.5;
  599.                     break;
  600.                 case "d":
  601.                     total = total + 1.5;
  602.                     break;
  603.                 case "F":
  604.                     total = total + 0.5;
  605.                     break;
  606.                 case "f":
  607.                     total = total + 0.5;
  608.                     break;
  609.                 default:
  610.                     break;
  611.             }
  612.  
  613.             #endregion
  614.  
  615.             #region ap
  616.  
  617.             switch (apclass1)
  618.             {
  619.                 case "A":
  620.                     total = total + 5.0;
  621.                     break;
  622.                 case "a":
  623.                     total = total + 5.0;
  624.                     break;
  625.                 case "B":
  626.                     total = total + 4.0;
  627.                     break;
  628.                 case "b":
  629.                     total = total + 4.0;
  630.                     break;
  631.                 case "C":
  632.                     total = total + 3.0;
  633.                     break;
  634.                 case "c":
  635.                     total = total + 3.0;
  636.                     break;
  637.                 case "D":
  638.                     total = total + 2.0;
  639.                     break;
  640.                 case "d":
  641.                     total = total + 2.0;
  642.                     break;
  643.                 case "F":
  644.                     total = total + 1.0;
  645.                     break;
  646.                 case "f":
  647.                     total = total + 1.0;
  648.                     break;
  649.                 default:
  650.                     break;
  651.             }
  652.  
  653.             switch (apclass2)
  654.             {
  655.                 case "A":
  656.                     total = total + 5.0;
  657.                     break;
  658.                 case "a":
  659.                     total = total + 5.0;
  660.                     break;
  661.                 case "B":
  662.                     total = total + 4.0;
  663.                     break;
  664.                 case "b":
  665.                     total = total + 4.0;
  666.                     break;
  667.                 case "C":
  668.                     total = total + 3.0;
  669.                     break;
  670.                 case "c":
  671.                     total = total + 3.0;
  672.                     break;
  673.                 case "D":
  674.                     total = total + 2.0;
  675.                     break;
  676.                 case "d":
  677.                     total = total + 2.0;
  678.                     break;
  679.                 case "F":
  680.                     total = total + 1.0;
  681.                     break;
  682.                 case "f":
  683.                     total = total + 1.0;
  684.                     break;
  685.                 default:
  686.                     break;
  687.             }
  688.  
  689.             switch (apclass3)
  690.             {
  691.                 case "A":
  692.                     total = total + 5.0;
  693.                     break;
  694.                 case "a":
  695.                     total = total + 5.0;
  696.                     break;
  697.                 case "B":
  698.                     total = total + 4.0;
  699.                     break;
  700.                 case "b":
  701.                     total = total + 4.0;
  702.                     break;
  703.                 case "C":
  704.                     total = total + 3.0;
  705.                     break;
  706.                 case "c":
  707.                     total = total + 3.0;
  708.                     break;
  709.                 case "D":
  710.                     total = total + 2.0;
  711.                     break;
  712.                 case "d":
  713.                     total = total + 2.0;
  714.                     break;
  715.                 case "F":
  716.                     total = total + 1.0;
  717.                     break;
  718.                 case "f":
  719.                     total = total + 1.0;
  720.                     break;
  721.                 default:
  722.                     break;
  723.             }
  724.  
  725.             switch (apclass4)
  726.             {
  727.                 case "A":
  728.                     total = total + 5.0;
  729.                     break;
  730.                 case "a":
  731.                     total = total + 5.0;
  732.                     break;
  733.                 case "B":
  734.                     total = total + 4.0;
  735.                     break;
  736.                 case "b":
  737.                     total = total + 4.0;
  738.                     break;
  739.                 case "C":
  740.                     total = total + 3.0;
  741.                     break;
  742.                 case "c":
  743.                     total = total + 3.0;
  744.                     break;
  745.                 case "D":
  746.                     total = total + 2.0;
  747.                     break;
  748.                 case "d":
  749.                     total = total + 2.0;
  750.                     break;
  751.                 case "F":
  752.                     total = total + 1.0;
  753.                     break;
  754.                 case "f":
  755.                     total = total + 1.0;
  756.                     break;
  757.                 default:
  758.                     break;
  759.             }
  760.             #endregion
  761.  
  762.             return total;
  763.         }
  764.  
  765.         #endregion
  766.  
  767.         #region money
  768.  
  769.         static void moneyCalculate()
  770.         {
  771.             Console.Clear();
  772.             Console.WriteLine();
  773.             Console.WriteLine("Money Calculator Initialized");
  774.             Console.WriteLine("=======================================");
  775.             Console.WriteLine("This is calculated using the following format");
  776.             Console.WriteLine("Report Card Grades:");
  777.             Console.WriteLine("Each A | $10");
  778.             Console.WriteLine("Each B | $5");
  779.             Console.WriteLine("Each C | $0");
  780.             Console.WriteLine("Each D | -$5");
  781.             Console.WriteLine("Each F | -20");
  782.             Console.WriteLine("Assignment Grades:");
  783.             Console.WriteLine("Each A | $.50");
  784.             Console.WriteLine("Each B | $.25");
  785.             Console.WriteLine("Each C | $0");
  786.             Console.WriteLine("Each D | -$.25");
  787.             Console.WriteLine("Each F | -$1");
  788.             Console.WriteLine("=======================================");
  789.             Console.WriteLine("Currently Only Supports a single reporting quarter.");
  790.             Console.WriteLine("=======================================");
  791.             Console.WriteLine();
  792.  
  793.             getRCard();
  794.  
  795.             getAssignGrade();
  796.  
  797.             double rCard = calcRCard();
  798.  
  799.             double aGrade = calcAssignGrade();
  800.  
  801.             double total = rCard + aGrade;
  802.  
  803.             double divtotal1 = rCard / 2;
  804.             double divtotal2 = divtotal1 + aGrade;
  805.  
  806.             Console.WriteLine("=======================================");
  807.             Console.WriteLine("Your money has been Calculated!");
  808.             Console.WriteLine("=======================================");
  809.             Console.WriteLine("Your total ammount is: ${0}", total);
  810.             Console.WriteLine("You will recieve ${0} in cash", divtotal2);
  811.             Console.WriteLine("${0} will be going into your Savings account", divtotal1);
  812.             Console.WriteLine("${0} will be coming from Report card grades", rCard);
  813.             Console.WriteLine("${0} will be coming from Assignment Grades", aGrade);
  814.             Console.WriteLine("=======================================");
  815.             Console.WriteLine();
  816.             Console.WriteLine("Press any key to return to the menu.");
  817.             Console.ReadKey();
  818.  
  819.             Process();
  820.  
  821.         }
  822.  
  823.         static void getRCard()
  824.         {
  825.             Console.WriteLine("=======================================");
  826.             Console.WriteLine("Enter report card grades when prompted.");
  827.             Console.WriteLine("=======================================");
  828.             Console.WriteLine("Enter first letter grade");
  829.             rgrade1 = Console.ReadLine();
  830.             Console.WriteLine("Enter second letter grade");
  831.             rgrade2 = Console.ReadLine();
  832.             Console.WriteLine("Enter third letter grade");
  833.             rgrade3 = Console.ReadLine();
  834.             Console.WriteLine("Enter fourth letter grade");
  835.             rgrade4 = Console.ReadLine();
  836.             Console.WriteLine("=======================================");
  837.             Console.WriteLine();
  838.  
  839.             rgrade1 = rgrade1.ToUpper();
  840.             rgrade2 = rgrade2.ToUpper();
  841.             rgrade3 = rgrade3.ToUpper();
  842.             rgrade4 = rgrade4.ToUpper();
  843.         }
  844.  
  845.         static void getAssignGrade()
  846.         {
  847.  
  848.             Console.WriteLine("=======================================");
  849.             Console.WriteLine("Enter assignment grades when prompted.");
  850.             Console.WriteLine("=======================================");
  851.             Console.WriteLine("Enter the number of A's you recieved");
  852.             agrade = int.Parse(Console.ReadLine());
  853.             Console.WriteLine("Enter the number of B's you recieved");
  854.             bgrade = int.Parse(Console.ReadLine());
  855.             Console.WriteLine("Enter the number of C's you recieved");
  856.             cgrade = int.Parse(Console.ReadLine());
  857.             Console.WriteLine("Enter the number of D's you recieved");
  858.             dgrade = int.Parse(Console.ReadLine());
  859.             Console.WriteLine("Enter the number of F's you recieved");
  860.             fgrade = int.Parse(Console.ReadLine());
  861.         }
  862.  
  863.         static double calcRCard()
  864.         {
  865.             double total = 0.0;
  866.  
  867.             switch (rgrade1)
  868.             {
  869.                 case "A":
  870.                     total = total + 10.0;
  871.                     break;
  872.                 case "B":
  873.                     total = total + 5.0;
  874.                     break;
  875.                 case "C":
  876.                     total = total + 0.0;
  877.                     break;
  878.                 case "D":
  879.                     total = total - 5.0;
  880.                     break;
  881.                 case "F":
  882.                     total = total - 20.0;
  883.                     break;
  884.             }
  885.  
  886.             switch (rgrade2)
  887.             {
  888.                 case "A":
  889.                     total = total + 10.0;
  890.                     break;
  891.                 case "B":
  892.                     total = total + 5.0;
  893.                     break;
  894.                 case "C":
  895.                     total = total + 0.0;
  896.                     break;
  897.                 case "D":
  898.                     total = total - 5.0;
  899.                     break;
  900.                 case "F":
  901.                     total = total - 20.0;
  902.                     break;
  903.             }
  904.  
  905.             switch (rgrade3)
  906.             {
  907.                 case "A":
  908.                     total = total + 10.0;
  909.                     break;
  910.                 case "B":
  911.                     total = total + 5.0;
  912.                     break;
  913.                 case "C":
  914.                     total = total + 0.0;
  915.                     break;
  916.                 case "D":
  917.                     total = total - 5.0;
  918.                     break;
  919.                 case "F":
  920.                     total = total - 20.0;
  921.                     break;
  922.             }
  923.  
  924.             switch (rgrade4)
  925.             {
  926.                 case "A":
  927.                     total = total + 10.0;
  928.                     break;
  929.                 case "B":
  930.                     total = total + 5.0;
  931.                     break;
  932.                 case "C":
  933.                     total = total + 0.0;
  934.                     break;
  935.                 case "D":
  936.                     total = total - 5.0;
  937.                     break;
  938.                 case "F":
  939.                     total = total - 20.0;
  940.                     break;
  941.             }
  942.  
  943.             return total;
  944.         }
  945.  
  946.         static double calcAssignGrade()
  947.         {
  948.             double total = 0.0;
  949.  
  950.             double atotal = agrade * 0.5;
  951.             double btotal = bgrade * 0.25;
  952.             double ctotal = 0.0;
  953.             double dtotal = dgrade * 5.0;
  954.             dtotal = dtotal * -1;
  955.             double ftotal = fgrade * 20.0;
  956.             ftotal = ftotal * -1;
  957.  
  958.             total = atotal + btotal + ctotal + dtotal + ftotal;
  959.  
  960.             return total;
  961.         }
  962.         #endregion
  963.  
  964.         #region other
  965.         static void consoleNoClose()
  966.         {
  967.             Console.WriteLine();
  968.             Console.WriteLine();
  969.             Console.WriteLine("Press Any Key to Exit . . .");
  970.             Console.ReadKey();
  971.         }      
  972.         #endregion
  973.     }
  974. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement