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

Using C# and including comments to explain implementation Create a Console Appli

ID: 3889961 • Letter: U

Question

Using C# and including comments to explain implementation

Create a Console Application Project called GradeBook that includes the following two classes:

****GradeBook.cs******

// GradeBook class with an auto-implemented property.
using System;
using static System.Console;

public class GradeBook
{
// auto-implemented property CourseName implicitly creates
// an instance variable for this GradeBook's course name
public string CourseName { get; set; }

// display a welcome message to the GradeBook user
public void DisplayMessage()
{
// use auto-implemented property CourseName to get the
// name of the course that this GradeBook represents
Console.WriteLine("Welcome to the grade book for {0}!",
CourseName); // display property CourseName
Console.ReadLine();
} // end method DisplayMessage
} // end class GradeBook

*******************************************************************


***********GradeBookTest.cs*************

// Creates and manipulate a GradeBook object.
using System;
using static System.Console;

public class GradeBookTest
{
// Main method begins program execution
public static void Main( string [] args )
{
// create a GradeBook object and assign it to myGradeBook
GradeBook myGradeBook = new GradeBook();

// display initial value of CourseName
Console.WriteLine("Initial course name is: '{0}' ",
myGradeBook.CourseName);

// prompt for and read course name
Console.WriteLine("Please enter the course name:");
myGradeBook.CourseName = Console.ReadLine(); // set CourseName
Console.WriteLine(); // output a blank line

// display welcome message
myGradeBook.DisplayMessage();
} // end Main
} // end class GradeBookTest

***********************************************************************

Modify the two GradeBook classes as follows:

- Include a second string auto-implented property that represents the name of the course’s instructor.
- Modify the constructor to specify two parameters–one for the course name and one for the instructor’s name.
- Modify the DisplayMessage method such that it first outputs the welcome message and course name, then outputs, “This course is presented by: “, followed by the instructor’s name.
-Reference a constructor not provided in the initial code
-Maybe should just provide it
-Then initial ‘test’ program must provide a course name parameter
-Remove readline from the display message method
-Use a regular property with explicit get and set?
allow students to use an auto-implementation if they want?
Or require that they use it?

Testing program
- Modify initialization of course name and/or course instructor?

Explanation / Answer

Source Code:

using System;
using static System.Console;
public class GradeBook
{
// auto-implemented property CourseName implicitly creates
// an instance variable for this GradeBook's course name
public string CourseName { get; set; }
public string CourseInstructor { get; set; } = "Jhon";
// display a welcome message to the GradeBook user
public void DisplayMessage()
{
// use auto-implemented property CourseName to get the
// name of the course that this GradeBook represents
Console.WriteLine("Welcome to the grade book "+CourseName+" This course is presented by "+CourseInstructor); // display property CourseName

  
  
} // end method DisplayMessage
}
public class GradeBookTest
{
// Main method begins program execution
public static void Main( string [] args )
{
// create a GradeBook object and assign it to myGradeBook
GradeBook myGradeBook = new GradeBook();
// display initial value of CourseName
Console.WriteLine("Initial course name is: '{0}' ",
myGradeBook.CourseName);
// prompt for and read course name
Console.WriteLine("Please enter the course name:");
myGradeBook.CourseName = Console.ReadLine(); // set CourseName
Console.WriteLine(); // output a blank line
// display welcome message
myGradeBook.DisplayMessage();
  
Console.WriteLine("Please enter modifed course instrcutor name:");
  
myGradeBook.CourseInstructor = Console.ReadLine(); // Set the instrcutor name
  
  
myGradeBook.DisplayMessage(); // display welcome message and instrcutor name
  
} // end Main
} // end class GradeBookTest

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote