Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started