Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# SAMPLE CODE: For this task you are given a partially-complete program a progr

ID: 3712774 • Letter: C

Question

C#

SAMPLE CODE:

For this task you are given a partially-complete program a program designed to show the number of enrolment positions open for each class, or display that the class is full if that is the case The completed program should first display the text "Number of places still available for each class." followed by a blank line. Following this blank line, it should display one line of text for each class. That line should be of the following format "(class name has (number of places left) places left." class namehas number of places le The number of places left in each class is the maximum enrolment minus the current enrolment. If there are no places left (the current enrolment is the same as the maximum enrolment) this line should instead be displayed: (class name) is full."

Explanation / Answer

//Please paste the following code in missing lines, you will get output

for(i=0;i<className.Length;i++)
{
int n=maximumEnrolment[i]-currentEnrolment[i];
if(n>0)
{
Console.WriteLine(className[i]+" has "+n+" places left");
}
}

for(i=0;i<className.Length;i++)
{
int n=maximumEnrolment[i]-currentEnrolment[i];
if(n==0)
{
Console.WriteLine(className[i]+" is full");
}
}