>>106991902
in rust
struct DateInvitation {
name: String,
location: String,
time: String,
charm_level: i32,
}
impl DateInvitation {
fn new(name: &str, location: &str, time: &str, charm: i32) -> Self {
DateInvitation {
name: name.to_string(),
location: location.to_string(),
time: time.to_string(),
charm_level: charm,
}
}
}
fn ask_out(invitation: &DateInvitation) {
println!(
"Hey {}, I was wondering if you'd like to grab a coffee at {} around {}?",
invitation.name, invitation.location, invitation.time
);
if invitation.charm_level > 7 {
println!(
"*{} smiles* 'That sounds lovely! See you there!'",
invitation.name
);
} else {
println!(
"*{} hesitates* 'Hmm, I'll think about it...'",
invitation.name
);
}
}
fn main() {
let coffee_date = DateInvitation::new("Emma", "Starbucks", "3 PM", 8);
ask_out(&coffee_date);
}