using style=”color:#000000;background-color:#FFFFFF;”> System
using style=”color:#000000;background-color:#FFFFFF;”> System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace iLab6{ class Program { static void Main(string[] args) { double[] chevyCars = new double[8]; double[] fordCars = new double[8]; String[] chevyCarsStr = new String[8]; String[] fordCarsStr = new String[8]; int chveyWin = 0; int fordWin = 0; float diff = 0.0; //input values for chevy Console.Write(“Enter the times for the Chevy cars: “); chevyCarsStr = Console.ReadLine().Split(‘ ‘); for (int i = 0; i < 8; i++) { chevyCars[i] = Convert.ToDouble(chevyCarsStr[i]); } //input values for Ford Console.Write(“Enter the times for the corresponding Ford cars: “); fordCarsStr = Console.ReadLine().Split(‘ ‘); for (int i = 0; i < 8; i++) { fordCars[i] = Convert.ToDouble(fordCarsStr[i]); } Console.WriteLine(“And the winners are: “); for (int i = 0; i < 8; i++) { diff =(float)( chevyCars[i] – fordCars[i]); if (diff == 0.0) { Console.WriteLine(“Tie!”); } else if (diff < 0.0) { Console.WriteLine(“Chevy by ” + -1*diff + ” sec”); chveyWin++; } else { Console.WriteLine(“Ford by ” + diff + ” sec”); fordWin++; } } if (chveyWin < fordWin) { Console.WriteLine(“And the winning team is: F O R D !”); } else if (chveyWin > fordWin) { Console.WriteLine(“And the winning team is: C H E V Y !”); } else { Console.WriteLine(“And the winning team is: N O N E !”); } } }}
ATTACHMENT PREVIEW Download attachmentScreenshot (153).pngfl ConsciieAppiicatiorilZ (Debugging) – Microsoft Visual Studio Quick Launch (Ct’HQ) p — E X
EELE EDIT \lTEW ERDJECT EUIILD QEBUG TEAM SQL IOOLS TEST AflALYZE flINDDW flELP E_°-.___= #9v’v hgmfinuevoebug no +§.e,¢3§:333-‘; – a" :
“gimbapmgrem – eaMainfiIIingfl args) .
I Uinput values for Chevy #
| CDnSDle.Hrite("Enter the times for the Chevy (ars‘. A
I
I :hevyfarsstr = Ennsule.ReadLine().Split(‘ ‘);
I
I for (int i = 6; i < E; i-H-j
I {
D | __eheuyCars[i] Convert d)oub1&((hevy(ar55tr[i]) ‘
I }
I n\ ! lndexOutOfRangeExceptinn was unhandled x
I Index was outsidethe bounés of the array.
I Uinput values for Ford RENEW-Jigs:
I ConsDIeMriteC’Enter the times for the correspanding Fc Make sure at ‘
I fordCar‘sStr‘ = CDnlee.ReadLine().Split(‘ ’j; " " " "
I Make surethe index is nota negative numberi
I for (int i = 0; i < B; :I-H-J Make surethatthe maximum indexori alistislessthari thelist size.
I i _ _ Get generai helpforthis exception LI
I fordCar‘sEl] = Convert.ToDouble(fordCarsStr[1]);
I } SearchformareHelpOriiinem
I Consnle.flriteLine{"And the winners are: "I: v
100% – Bicepb’onsetfings:
Wabd’i 1 1 I— Breakwheri this exceptiari typeis thrown – 1 V Jil X
Name Vafue _
Actual:
VIEWDE’tEIIm Copy exception detaii to the clipboard
Open exception settings cal 1.7
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
