Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C# to code this: Using the provided code, do the following: Add to the instructor class the fields: the number of credit hours, department

Use C# to code this:

Using the provided code, do the following:

  1. Add to the instructor class the fields: the number of credit hours, department code, course number.
  2. Create two more objects
  3. Input from the keyboard all needed data for at least one of the newly created objects

Here are the two files given

Program.cs:

// Homework 1:

using System;

namespace CourseInfo

{

class Program

{

static void printCourseInfo(String courseName, String instructor )

{

Console.WriteLine($"course name : {courseName} and instructor: {instructor} ");

}

static void Main(string[] args)

{

String courseName = "Programming in C#";

String teacher = "Alrifai";

instructor rad = new instructor(courseName, teacher);

instructor mark = new instructor("Intro. to Math", "Buckle");

rad.printCourseInfo();

mark.printCourseInfo();

}

}

}

Instructor.cs:

using System;

using System.Collections.Generic;

using System.Text;

namespace CourseInfo

{

class instructor

{

public String courseName { get; set; }// set is a mutator and Get accesses

public String instructorName { get; set; }

public instructor(String courseName, String instructorName) //constructor

{

this.courseName = courseName;

this.instructorName = instructorName;

Console.WriteLine("The construcor is called");

}

//constructor

public void printCourseInfo()

{

Console.WriteLine($"course name : {courseName} and instructor: {instructorName} ");

}

}

}

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

What metaphors might describe how we work together?

Answered: 1 week ago

Question

What are some of the possible scenes from our future?

Answered: 1 week ago