Question: Go (programming language) Create a map that uses a string representing a course code as key. The value in the map needs to be a

Go (programming language)

Create a map that uses a string representing a course code as key. The value in the map needs to be a structure with basic information about the course. The following main routine:

import "fmt" // Define a suitable structure func main() { // Create a dynamic map m // Add the courses CSI2120 and CSI2110 to the map for k, v := range m { fmt.Printf("Course Code: %s ", k) fmt.Printf("Number of students: %d ", v.NStudents) fmt.Printf("Professor: %s ", v.Professor) fmt.Printf("Average: %f ", v.Avg) } } 

must print:

Course Code: CSI2110 Number of students: 186 Professor: Lang Average: 79.500000 Course Code: CSI2120 Number of students: 211 Professor: Moura Average: 81.000000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!