Pure Programmer
Blue Matrix


Cluster Map

Project: Jackpot Winnings

If three people who contribute $10 each to buy lottery tickets win a jackpot of $20,000, compute how much profit each winner has earned. Use named constants where appropriate.

Output
$ rustc JackpotWinner.rs error: unknown format trait `f` --> JackpotWinner.rs:12:59 | 12 | println!("{}", format!("Jackpot Profit per Player: ${0:.2f}", profitPerPlayer)); | ^ | = 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[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> JackpotWinner.rs:8:34 | 8 | static mut PLAYER_BUYIN:f64 = 10.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 8 | static mut PLAYER_BUYIN:f64 = 10.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> JackpotWinner.rs:9:32 | 9 | static mut JACKPOT:f64 = 20000.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 9 | static mut JACKPOT:f64 = 20000.0f64; | + error[E0277]: the trait bound `f64: From<isize>` is not satisfied --> JackpotWinner.rs:11:52 | 11 | let mut profitPerPlayer:f64 = JACKPOT / f64::from(PLAYERS) - PLAYER_BUYIN; | --------- ^^^^^^^ 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: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0610. For more information about an error, try `rustc --explain E0277`.

Solution