Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program with Visual Studio, C# Car Racing with Arrays, Objects, Methods Problem Description In this program, you will simulate a car racing competition.

image text in transcribed

Create a program with Visual Studio, C#

Car Racing with Arrays, Objects, Methods

Problem Description In this program, you will simulate a car racing competition. Create a project called Car Racing, which contains your main form, and a class called Car, to represent the cars. There will be noofCars, as entered by a user, on each competition.

Each car consists of the following attributes: a. driver: An 8-character string of the form Driven, where nn is a 2-digit number starting at MIN_DRIVER_NO = 10 and is incremented by 1 for each consecutive car. c. speed: A random integer number, inclusively, between MIN_SPEED = 50 and MAX_SPEED = 200. Create an appropriate array, carArray, to store and manage the cars participating in a race.

Write appropriate program segments and methods to carry out the following operations: 1. Create cars a. Create noofCars cars. Set the speed of each car to Zero (0), and the respective driver to Driver. As it was mentioned above, nn is a 2-digit number starting at MIN_DRIVER_NO = 10 and is incremented by 1 for each consecutive car. b. The user enters the number of cars, noofCars, to compete in the No. of Cars field. 2. Race Cars Set the speed of each car to a random number between MIN_SPEED = 50 and MAX_SPEED = 200, inclusively. Use SEED = 100 for the random number generator. 3. Sort by Speed Sort the cars in descending order of the speeds. That is, from the highest to the lowest speed. 4. Display Cars Display all the cars to include each driver name and the respective car speed.

Create Cars 2 Car Racing Race Cars Car Racing cars are created The 7 car competition is completed! Csate Cars Dolny Cars Race Cars Sort by Speed Create Can Day Car Face Cars Sort by Speed X Display Cars Car Racing Ne con Driver: Drver 10 Driver Driver 11 Driver Driver 12 Driver Driver 13 Driver: Driver 14 Driver: Driver 15 Driver: Driver 16 Speed: 0 Speed: Speed: 0 Speedo Speed: 0 Speed: 0 Speed: 0 Rare Beast by Samed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions