mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-10 12:49:18 +00:00
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
struct Student {
|
|
name: String,
|
|
id: i32,
|
|
major: String,
|
|
gradyear: i32,
|
|
}
|
|
|
|
// define associate functions to create the following instances, use shorthand wherever available
|
|
|
|
// define methods to satisfy the requirements
|
|
|
|
// define functions to satisfy the requirements
|
|
|
|
fn main() {
|
|
// a vector<Student> and push the following instances
|
|
|
|
// an instance of student (Adam Helex, 1022, CS, 2022)
|
|
|
|
// an instance of student (Rob Delon, 1033, Bio, 2023)
|
|
|
|
// an instance of student (Jenny Susan, 1044, CS, 2023)
|
|
|
|
// an instance of student (Nick Frank, 1055, CS, 2022)
|
|
|
|
// an instance of student (Michael Dodge, 1066, Bio, 2023)
|
|
|
|
// Note: shorthand possible for Rob and Michael; Adam and Helex
|
|
|
|
// call a function that will return list of students graduating by year
|
|
|
|
// call a function that will return list of the last name of students
|
|
|
|
// call a function that will sort the students by their first name
|
|
|
|
// call a method that will return true if any two students are graduating same year
|
|
|
|
// call a method that will modify the student last name to a desired one
|
|
}
|