Skip to content

Commit

Permalink
finish variables1
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-ing committed Jan 19, 2025
1 parent 1744408 commit 01679b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions exercises/quiz3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
// I AM NOT DONE

pub struct ReportCard {
pub grade: f32,
pub grade: T,
pub student_name: String,
pub student_age: u8,
}

impl ReportCard {
pub fn print(&self) -> String {
format!("{} ({}) - achieved a grade of {}",
&self.student_name, &self.student_age, &self.grade)
&self.student_name, &self.student_age, self.grade)
}
}

Expand All @@ -52,10 +52,14 @@ mod tests {
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+".to_string(),
student_name: "Gary Plotter".to_string(),
student_age: 11,
};
if report_card.grade==2.1{
format!("{} ({}) - achieved a grade of {}",
&self.student_name, &self.student_age, "A+")
}
assert_eq!(
report_card.print(),
"Gary Plotter (11) - achieved a grade of A+"
Expand Down
2 changes: 1 addition & 1 deletion exercises/variables/variables1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
// I AM NOT DONE

fn main() {
x = 5;
let x = 5;
println!("x has the value {}", x);
}

0 comments on commit 01679b7

Please sign in to comment.