This commit is contained in:
perro tuerto 2023-02-27 10:18:39 -08:00
parent 38cda643f7
commit ddcbe65713
1 changed files with 5 additions and 7 deletions

View File

@ -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<T> {
pub grade: T,
pub student_name: String,
pub student_age: u8,
}
impl ReportCard {
impl<T: std::fmt::Display> ReportCard<T> {
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,
};