Pure Programmer
Blue Matrix


Cluster Map

Project: Football Passer Rating (with Assertions)

The passer rating formula provides one metric that can be used to compare the performance of quarterbacks. It is based on the number of completions, touchdown passes, interceptions and total passing yards. Write a program that prompts for the number of completed passes, touchdown passes, interceptions, total passing yards, the total number of attempted passes and whether the NFL or NCAA passer rating should be displayed. Print the rating to one decimal place.

The program should call one of two functions to compute the NFL or NCAA passer rating. Each function should have pre-conditions that check for the following:

  1. Attempts are greater or equal to zero
  2. Completions are greater or equal to zero
  3. Touchdown passes are greater or equal to zero
  4. Interceptions are greater or equal to zero
  5. Passing yards are greater or equal to zero
  6. Completions plus interceptions is less than or equal to total passing attempts

Each function should also have post-conditions the enforce the minimum and maximum possible value for passer rating:

  1. NFL Minimum: 0.0
  2. NFL Maximum: 158.3
  3. NCAA Minimum: −731.6
  4. NCAA Maximum: 1261.6

See [[Passer Rating]] for the NFL and NCAA formulas.

See FootballPasserRating3

Output
$ rustc FootballPasserRating4.rs error: unknown format trait `f` --> FootballPasserRating4.rs:69:52 | 69 | println!("{}", format!("NFL Passer rating: {0:.1f}", rating)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `f` --> FootballPasserRating4.rs:72:53 | 72 | println!("{}", format!("NCAA Passer rating: {0:.1f}", rating)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:49:16 | 49 | inputStr = &(Utils.prompt("Number of attempts: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:52:16 | 52 | inputStr = &(Utils.prompt("Number of completions: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:55:16 | 55 | inputStr = &(Utils.prompt("Number of touchdown passes: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:58:16 | 58 | inputStr = &(Utils.prompt("Number of interceptions: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:61:16 | 61 | inputStr = &(Utils.prompt("Number of passing yards: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:64:16 | 64 | inputStr = &(Utils.prompt("1 for NFL or 2 for NCAA: ")); | ^^^^^ not found in this scope error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:18:25 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | --------- ^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:18:50 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:18:74 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.0f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:19:25 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | --------- ^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:19:51 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:19:65 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.0f64) * 0.25f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:20:24 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | --------- ^^^^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:20:53 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:20:68 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.0f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:21:36 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | --------- ^^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:21:63 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:21:78 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.0f64); | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:22:39 | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 22 | let rating:f64 = (a + b + c + d) / 6.0f64 * 100.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:22:49 | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:23:22 | 23 | assert!(rating >= 0.f64, "rating >= 0.f64"); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 23 | assert!(rating >= 0.0f64, "rating >= 0.f64"); | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:36:18 | 36 | let b:f64 = 330.f64 * (touchdownPasses) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 36 | let b:f64 = 330.0f64 * (touchdownPasses) as f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:37:18 | 37 | let c:f64 = 100.f64 * (completions) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 37 | let c:f64 = 100.0f64 * (completions) as f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:38:18 | 38 | let d:f64 = 200.f64 * (interceptions) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 38 | let d:f64 = 200.0f64 * (interceptions) as f64; | + error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:50:14 | 50 | attempts = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:53:17 | 53 | completions = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:56:21 | 56 | touchdownPasses = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:59:19 | 59 | interceptions = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:62:18 | 62 | passingYards = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:65:11 | 65 | which = stoi(inputStr)?; | ^^^^ not found in this scope error: aborting due to 32 previous errors Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`. $ rustc FootballPasserRating4.rs error: unknown format trait `f` --> FootballPasserRating4.rs:69:52 | 69 | println!("{}", format!("NFL Passer rating: {0:.1f}", rating)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `f` --> FootballPasserRating4.rs:72:53 | 72 | println!("{}", format!("NCAA Passer rating: {0:.1f}", rating)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:49:16 | 49 | inputStr = &(Utils.prompt("Number of attempts: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:52:16 | 52 | inputStr = &(Utils.prompt("Number of completions: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:55:16 | 55 | inputStr = &(Utils.prompt("Number of touchdown passes: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:58:16 | 58 | inputStr = &(Utils.prompt("Number of interceptions: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:61:16 | 61 | inputStr = &(Utils.prompt("Number of passing yards: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:64:16 | 64 | inputStr = &(Utils.prompt("1 for NFL or 2 for NCAA: ")); | ^^^^^ not found in this scope error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:18:25 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | --------- ^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:18:50 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:18:74 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.0f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:19:25 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | --------- ^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:19:51 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:19:65 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.0f64) * 0.25f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:20:24 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | --------- ^^^^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:20:53 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:20:68 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.0f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:21:36 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | --------- ^^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:21:63 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:21:78 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.0f64); | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:22:39 | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 22 | let rating:f64 = (a + b + c + d) / 6.0f64 * 100.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:22:49 | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:23:22 | 23 | assert!(rating >= 0.f64, "rating >= 0.f64"); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 23 | assert!(rating >= 0.0f64, "rating >= 0.f64"); | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:36:18 | 36 | let b:f64 = 330.f64 * (touchdownPasses) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 36 | let b:f64 = 330.0f64 * (touchdownPasses) as f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:37:18 | 37 | let c:f64 = 100.f64 * (completions) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 37 | let c:f64 = 100.0f64 * (completions) as f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:38:18 | 38 | let d:f64 = 200.f64 * (interceptions) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 38 | let d:f64 = 200.0f64 * (interceptions) as f64; | + error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:50:14 | 50 | attempts = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:53:17 | 53 | completions = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:56:21 | 56 | touchdownPasses = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:59:19 | 59 | interceptions = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:62:18 | 62 | passingYards = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:65:11 | 65 | which = stoi(inputStr)?; | ^^^^ not found in this scope error: aborting due to 32 previous errors Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`. $ rustc FootballPasserRating4.rs error: unknown format trait `f` --> FootballPasserRating4.rs:69:52 | 69 | println!("{}", format!("NFL Passer rating: {0:.1f}", rating)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `f` --> FootballPasserRating4.rs:72:53 | 72 | println!("{}", format!("NCAA Passer rating: {0:.1f}", rating)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:49:16 | 49 | inputStr = &(Utils.prompt("Number of attempts: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:52:16 | 52 | inputStr = &(Utils.prompt("Number of completions: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:55:16 | 55 | inputStr = &(Utils.prompt("Number of touchdown passes: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:58:16 | 58 | inputStr = &(Utils.prompt("Number of interceptions: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:61:16 | 61 | inputStr = &(Utils.prompt("Number of passing yards: ")); | ^^^^^ not found in this scope error[E0425]: cannot find value `Utils` in this scope --> FootballPasserRating4.rs:64:16 | 64 | inputStr = &(Utils.prompt("1 for NFL or 2 for NCAA: ")); | ^^^^^ not found in this scope error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:18:25 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | --------- ^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:18:50 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:18:74 | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 18 | let a:f64 = (f64::from(completions) / f64::from(attempts) - 0.3f64) * 5.0f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:19:25 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | --------- ^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:19:51 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:19:65 | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.f64) * 0.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 19 | let b:f64 = (f64::from(passingYards) / f64::from(attempts) - 3.0f64) * 0.25f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:20:24 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | --------- ^^^^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:20:53 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:20:68 | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 20 | let c:f64 = f64::from(touchdownPasses) / f64::from(attempts) * 20.0f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:21:36 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | --------- ^^^^^^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> FootballPasserRating4.rs:21:63 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | --------- ^^^^^^^^ the trait `From<isize>` is not implemented for `f64` | | | required by a bound introduced by this call | = help: the following other types implement trait `From<T>`: <f64 as From<bool>> <f64 as From<f32>> <f64 as From<i16>> <f64 as From<i32>> <f64 as From<i8>> <f64 as From<u16>> <f64 as From<u32>> <f64 as From<u8>> error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:21:78 | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 21 | let d:f64 = 2.375f64 - (f64::from(interceptions) / f64::from(attempts) * 25.0f64); | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:22:39 | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 22 | let rating:f64 = (a + b + c + d) / 6.0f64 * 100.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:22:49 | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 22 | let rating:f64 = (a + b + c + d) / 6.f64 * 100.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:23:22 | 23 | assert!(rating >= 0.f64, "rating >= 0.f64"); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 23 | assert!(rating >= 0.0f64, "rating >= 0.f64"); | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:36:18 | 36 | let b:f64 = 330.f64 * (touchdownPasses) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 36 | let b:f64 = 330.0f64 * (touchdownPasses) as f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:37:18 | 37 | let c:f64 = 100.f64 * (completions) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 37 | let c:f64 = 100.0f64 * (completions) as f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> FootballPasserRating4.rs:38:18 | 38 | let d:f64 = 200.f64 * (interceptions) as f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 38 | let d:f64 = 200.0f64 * (interceptions) as f64; | + error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:50:14 | 50 | attempts = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:53:17 | 53 | completions = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:56:21 | 56 | touchdownPasses = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:59:19 | 59 | interceptions = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:62:18 | 62 | passingYards = stoi(inputStr)?; | ^^^^ not found in this scope error[E0425]: cannot find function `stoi` in this scope --> FootballPasserRating4.rs:65:11 | 65 | which = stoi(inputStr)?; | ^^^^ not found in this scope error: aborting due to 32 previous errors Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`.

Solution