Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Prompt: This assignment provides an opportunity to work with C# arrays. The exercise consists of source code that contains errors; therefore, it neither compiles nor

image text in transcribedimage text in transcribed Prompt: This assignment provides an opportunity to work with C\# arrays. The exercise consists of source code that contains errors; therefore, it neither compiles nor runs correctly. It focuses on a console application, but the concepts translate across C\# programming. Consider the following C\# console program that simply outputs a list of course names. Each course is represented as an object of a class called Course. The program does not use arrays. For the sake of simplicity and space, two classes are defined in the same file as opposed to the best practice of defining one class per file: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 \{ class Program \{ static void Main(string[] args) \{ Course course1 = new Course("IT 145"); Course course2 = new Course("IT 200"); Course course 3 = new Course("IT 201"); Course course4 = new Course("IT 270"); Course course5 = new Course("IT 315"); Course course6 = new Course("IT 328"); Course course7 = new Course("IT 330"); Console.WriteLine("Teacher's Copy"); Console.WriteLine("List of courses:"); Console.WriteLine(course1.getName()); Console.WriteLine(course2.getName()); Console.WriteLine(course3.getName()); Console.WriteLine(course4.getName()); Console.WriteLine(course5.getName()); Console.WriteLine(course6.getName()); Console.WriteLine(course7.getName()); \} \} class Course [ public Course(string name) \{ this.name = name; \} public string getName() [ return name; \} \} \} Modify the source code of the program so that is uses an array of Course objects instead of individual objects like course1, course2, etc. The modified program should still output the same result. The modified program output should look like this

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

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

7 Compare and contrast evaluative and developmental appraisal.

Answered: 1 week ago

Question

=+How will this affect the recruiting process?

Answered: 1 week ago