File tree Expand file tree Collapse file tree 4 files changed +4
-17
lines changed Expand file tree Collapse file tree 4 files changed +4
-17
lines changed Original file line number Diff line number Diff line change 7
7
// - An apple costs 2 rustbucks.
8
8
// - However, if Mary buys more than 40 apples, the price of each apple in the
9
9
// entire order is reduced to only 1 rustbuck!
10
+
10
11
// TODO: Write a function that calculates the price of an order of apples given
11
12
// the quantity bought.
12
-
13
- // Put your function here!
14
- // fn calculate_price_of_apples(???) -> ??? {
13
+ // fn calculate_price_of_apples(???) -> ??? { ??? }
15
14
16
15
fn main ( ) {
17
16
// You can optionally experiment here.
Original file line number Diff line number Diff line change 1
1
// Mary is buying apples. The price of an apple is calculated as follows:
2
2
// - An apple costs 2 rustbucks.
3
- // - If Mary buys more than 40 apples, each apple only costs 1 rustbuck!
4
- // Write a function that calculates the price of an order of apples given the
5
- // quantity bought.
3
+ // - However, if Mary buys more than 40 apples, the price of each apple in the
4
+ // entire order is reduced to only 1 rustbuck!
6
5
7
6
fn calculate_price_of_apples ( n_apples : u64 ) -> u64 {
8
7
if n_apples > 40 {
Original file line number Diff line number Diff line change 1
- // This is a quiz for the following sections:
2
- // - Strings
3
- // - Vecs
4
- // - Move semantics
5
- // - Modules
6
- // - Enums
7
- //
8
1
// Let's build a little machine in the form of a function. As input, we're going
9
2
// to give a list of strings and commands. These commands determine what action
10
3
// is going to be applied to the string. It can either be:
Original file line number Diff line number Diff line change 1
- // This quiz tests:
2
- // - Generics
3
- // - Traits
4
- //
5
1
// An imaginary magical school has a new report card generation system written
6
2
// in Rust! Currently, the system only supports creating report cards where the
7
3
// student's grade is represented numerically (e.g. 1.0 -> 5.5). However, the
You can’t perform that action at this time.
0 commit comments