39 lines
866 B
Go
39 lines
866 B
Go
![]() |
package main
|
||
|
|
||
|
// ---------------------------------------------------------
|
||
|
// EXERCISE: Warm-up
|
||
|
//
|
||
|
// Create and print the following maps.
|
||
|
//
|
||
|
// 1. Phone numbers by last name
|
||
|
// 2. Product availability by Product ID
|
||
|
// 3. Multiple phone numbers by last name
|
||
|
// 4. Shopping basket by Customer ID
|
||
|
//
|
||
|
// Each item in the shopping basket has a Product ID and
|
||
|
// quantity. Through the map, you can tell:
|
||
|
// "Mr. X has bought Y bananas"
|
||
|
//
|
||
|
// ---------------------------------------------------------
|
||
|
|
||
|
func main() {
|
||
|
// Hint: Store phone numbers as text
|
||
|
|
||
|
// #1
|
||
|
// Key : Last name
|
||
|
// Element : Last name
|
||
|
|
||
|
// #2
|
||
|
// Key : Product ID
|
||
|
// Element : Available / Unavailable
|
||
|
|
||
|
// #3
|
||
|
// Key : Last name
|
||
|
// Element : Phone numbers
|
||
|
|
||
|
// #4
|
||
|
// Key : Customer ID
|
||
|
// Element Key:
|
||
|
// Key: Product ID Element: Quantity
|
||
|
}
|