diff --git a/exercises/quiz1.rs b/exercises/quiz1.rs index 7bd3f589..201b96b5 100644 --- a/exercises/quiz1.rs +++ b/exercises/quiz1.rs @@ -8,10 +8,11 @@ // more than 40 at once, each apple only costs 1! Write a function that calculates // the price of an order of apples given the quantity bought. No hints this time! -// I AM NOT DONE - // Put your function here! -// fn calculate_apple_price { +fn calculate_apple_price(quantity: u32) -> u32 { + let price = if quantity > 40 { 1 } else {2}; + price * quantity +} // Don't modify this function! #[test]