Need help with C# assignment. Please add the output.
Review Dictionary<TKey, TValue> Class.
https://docs.microsoft.com/en-us/dotnet ... etcore-3.1
1. Create a class Course in "Course.cs". (20 points)
- create a constructor with two string parameters
"courseId" and "courseName".
- create two string data members "CID" with property
"ID"(set, get), and "CName" with property "Name"(set, get).
2. In "Program.cs", do followings: (20 points)
- Create 4 "Course" objects, set constructor with the
following values
- "course1" with cousre
id "CTS1851", course name "Internet Web Foundation"
- "course2" with cousre
id "CGS2820", course name "Web Programming"
- "course3" with cousre
id "CGS2821", course name "Advanced Web Programming"
- "course4" with cousre
id "COP2361", course name "C# Programming"
- Create a "Dictorinary" object "courses" with
"string"(course id) as key,
"Course" as
value, string(key)/Course(value)
pair ( Note: key type is string, value type is Course ). (20
points)
- call "Dictorinary"
method "Add() to add each course id and course to "courses". (20
points)
- use "foreach" to go
through "Dictionary", display each course id (key) and course name
( value.Name). (20 points)
Need help with C# assignment. Please add the output. Review Dictionary Class. https://docs.microsoft.com/e
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Need help with C# assignment. Please add the output. Review Dictionary Class. https://docs.microsoft.com/e
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!