new exercise

This commit is contained in:
mustakimur khandaker 2022-02-22 23:11:06 -05:00
parent c1655da38f
commit 53e1053b5c
3 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,40 @@
enum IPAddrKind {
V4(u8, u8, u8, u8),
V6(String),
}
enum MacAddrKind {
PHYSICAL(u64),
VIRTUAL(u32),
}
enum DeviceType {
Desktop(IPAddrKind),
Server(IPAddrKind),
Switch(MacAddrKind),
Router(MacAddrKind),
}
struct Device {
dtype: DeviceType,
name: String,
}
fn main() {
// create a hashmap of pairs <Device, Vec[Device]>
// "Desk1" [Desktop, V4] get connected to "Switch2", "Router1" [Router, Virtual]
// "Desk2" [Desktop, V6] get connected to "Switch1", "Router1"
// "Desk3" [Desktop, V4] get connected to "Server1" [Server, V4]
// "Switch1" [Switch, PHYSICAL] get connected to "Router1"
// "Switch2" [Switch, PHYSICAL] get connected to "Router2" [Router, Virtual]
// "Server2" [Server, V6] get connected to "Router2"
// Note: connections are suppose to be bidirectional, so write your methods in a way so that they would automatically handled
// Given a device name, return who are connected to it
// Given an IPAddrKind, return devices ip addresses who uses specific IPAddrKind
// Given Device1 and Device2, return true, if they are connected (including through other nodes)
// Given a device name, remove it from all of its connection
}

View File

@ -24,7 +24,7 @@ fn main() {
// an instance of student (Michael Dodge, 1066, Bio, 2023)
// Note: shorthand possible for Rob and Michael; Adam and Helex
// Note: shorthand possible for Rob and Michael; Adam and Nick
// call a function that will return list of students graduating by year

View File

@ -1059,4 +1059,10 @@ hint = ""
name = "students"
path = "exercises/students/students.rs"
mode = "compile"
hint = ""
[[exercises]]
name = "simulator"
path = "exercises/simulator/simulator.rs"
mode = "compile"
hint = ""