Pure Programmer
Blue Matrix


Cluster Map

Project: FICA Taxes

The Federal Insurance Contributions Act (FICA) is made up of two items, Social Security and Medicare taxes. In 2020 for wage earners that earn less than $137,700 per year, the Social Security tax rate is 6.2% and the Medicare tax rate is 1.45%. Write a program that computes the monthly paycheck for someone who earns a salary of $60,000. Print the base pay monthly pay, Social Security tax, Medicare tax and then the final net pay (base minus taxes).

Output
$ rustc FICA1.rs error: unknown format trait `f` --> FICA1.rs:17:43 | 17 | println!("{}", format!("Gross Pay: ${0:.2f}", grossPay)); | ^ | = 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` --> FICA1.rs:18:53 | 18 | println!("{}", format!("Social Security Tax: ${0:.2f}", ssTax)); | ^ | = 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` --> FICA1.rs:19:46 | 19 | println!("{}", format!("Medicare Tax: ${0:.2f}", medicareTax)); | ^ | = 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` --> FICA1.rs:20:41 | 20 | println!("{}", format!("Net Pay: ${0:.2f}", netPay)); | ^ | = 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: aborting due to 4 previous errors

Solution