From ddcbe65713bc9ac7b1a3314a0353a9ce1e0951d9 Mon Sep 17 00:00:00 2001 From: perro Date: Mon, 27 Feb 2023 10:18:39 -0800 Subject: [PATCH] Quiz 3 --- exercises/quiz3.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/exercises/quiz3.rs b/exercises/quiz3.rs index 15dc469..47558d0 100644 --- a/exercises/quiz3.rs +++ b/exercises/quiz3.rs @@ -13,16 +13,15 @@ // to show that your changes allow alphabetical grades. // Execute `rustlings hint quiz3` or use the `hint` watch subcommand for a hint. +use std::fmt::Display; -// I AM NOT DONE - -pub struct ReportCard { - pub grade: f32, +pub struct ReportCard { + pub grade: T, pub student_name: String, pub student_age: u8, } -impl ReportCard { +impl ReportCard { pub fn print(&self) -> String { format!("{} ({}) - achieved a grade of {}", &self.student_name, &self.student_age, &self.grade) @@ -48,9 +47,8 @@ mod tests { #[test] fn generate_alphabetic_report_card() { - // TODO: Make sure to change the grade here after you finish the exercise. let report_card = ReportCard { - grade: 2.1, + grade: "A+", student_name: "Gary Plotter".to_string(), student_age: 11, };