Pure Programmer
Blue Matrix


Cluster Map

Project: FICA Taxes (Empoyee and Employer)

As an employer you are responsible for withholding taxes and paying taxes assosciated with the employment of workers. An employer must withhold from the employee's paycheck Federal Insurance Contributions Act (FICA) is made up of two items, Social Security and Medicare taxes. For 2020, the Social Security tax rate is 6.2% on the first $137,700 wages plus tips paid. The Medicare tax rate is 1.45% on the first $200,000 wages and tips then 2.35% on wages and tips above $200,000.

The employeer must then pay additional Social Security tax of 6.2% up to the wage plus tip limit of $137,700. Additional Medicare taxes of 1.45% must be paied on all wages and tips. In addition Federal Unemployment Tax (FUTA) is 6.0% on the first $7,000 earned. Write a program that computes the annual taxes for someone who earns wages and tips. The program should accept two command line arguments, an annual wages and total tips for the year. Print the annual earnings (wages + tips), employee Social Security tax, employee Medicare tax, employer Social Security tax, employer Medicare tax and employer FUTA tax. Then print the net earnings (annual wages plus tips minus employee taxes) and the net contributions paid by employeer (wages plus employer FICA plus employer FUTA).

Output
$ rustc FICA3.rs error: unknown format trait `s` --> FICA3.rs:19:38 | 19 | println!("{}", format!("Syntax: {0:s} annual_wages annual_tips", utils::program_name().expect("program name should not be em... | ^ | = 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` --> FICA3.rs:54:49 | 54 | println!("{}", format!("Annual Earnings: ${0:.2f}", annualEarnings)); | ^ | = 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` --> FICA3.rs:55:53 | 55 | 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` --> FICA3.rs:56:46 | 56 | 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` --> FICA3.rs:57:62 | 57 | println!("{}", format!("Employer 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` --> FICA3.rs:58:55 | 58 | println!("{}", format!("Employer Medicare Tax: ${0:.2f}", employerMedicareTax)); | ^ | = 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` --> FICA3.rs:59:58 | 59 | println!("{}", format!("Federal Unemployment Tax: ${0:.2f}", futaTax)); | ^ | = 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` --> FICA3.rs:60:46 | 60 | println!("{}", format!("Net Earnings: ${0:.2f}", netEarnings)); | ^ | = 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` --> FICA3.rs:61:56 | 61 | println!("{}", format!("Employer Contributions: ${0:.2f}", employerContributions)); | ^ | = 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 `args` in this scope --> FICA3.rs:18:5 | 18 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> FICA3.rs:20:3 | 20 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> FICA3.rs:23:24 | 23 | let annualWages:f64 = Utils.stodWithDefault(args[1], 0.0f64); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> FICA3.rs:23:46 | 23 | let annualWages:f64 = Utils.stodWithDefault(args[1], 0.0f64); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> FICA3.rs:24:23 | 24 | let annualTips:f64 = Utils.stodWithDefault(args[2], 0.0f64); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> FICA3.rs:24:45 | 24 | let annualTips:f64 = Utils.stodWithDefault(args[2], 0.0f64); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0425`. $ rustc FICA3.rs error: unknown format trait `s` --> FICA3.rs:19:38 | 19 | println!("{}", format!("Syntax: {0:s} annual_wages annual_tips", utils::program_name().expect("program name should not be em... | ^ | = 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` --> FICA3.rs:54:49 | 54 | println!("{}", format!("Annual Earnings: ${0:.2f}", annualEarnings)); | ^ | = 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` --> FICA3.rs:55:53 | 55 | 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` --> FICA3.rs:56:46 | 56 | 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` --> FICA3.rs:57:62 | 57 | println!("{}", format!("Employer 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` --> FICA3.rs:58:55 | 58 | println!("{}", format!("Employer Medicare Tax: ${0:.2f}", employerMedicareTax)); | ^ | = 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` --> FICA3.rs:59:58 | 59 | println!("{}", format!("Federal Unemployment Tax: ${0:.2f}", futaTax)); | ^ | = 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` --> FICA3.rs:60:46 | 60 | println!("{}", format!("Net Earnings: ${0:.2f}", netEarnings)); | ^ | = 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` --> FICA3.rs:61:56 | 61 | println!("{}", format!("Employer Contributions: ${0:.2f}", employerContributions)); | ^ | = 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 `args` in this scope --> FICA3.rs:18:5 | 18 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> FICA3.rs:20:3 | 20 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> FICA3.rs:23:24 | 23 | let annualWages:f64 = Utils.stodWithDefault(args[1], 0.0f64); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> FICA3.rs:23:46 | 23 | let annualWages:f64 = Utils.stodWithDefault(args[1], 0.0f64); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> FICA3.rs:24:23 | 24 | let annualTips:f64 = Utils.stodWithDefault(args[2], 0.0f64); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> FICA3.rs:24:45 | 24 | let annualTips:f64 = Utils.stodWithDefault(args[2], 0.0f64); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0425`. $ rustc FICA3.rs error: unknown format trait `s` --> FICA3.rs:19:38 | 19 | println!("{}", format!("Syntax: {0:s} annual_wages annual_tips", utils::program_name().expect("program name should not be em... | ^ | = 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` --> FICA3.rs:54:49 | 54 | println!("{}", format!("Annual Earnings: ${0:.2f}", annualEarnings)); | ^ | = 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` --> FICA3.rs:55:53 | 55 | 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` --> FICA3.rs:56:46 | 56 | 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` --> FICA3.rs:57:62 | 57 | println!("{}", format!("Employer 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` --> FICA3.rs:58:55 | 58 | println!("{}", format!("Employer Medicare Tax: ${0:.2f}", employerMedicareTax)); | ^ | = 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` --> FICA3.rs:59:58 | 59 | println!("{}", format!("Federal Unemployment Tax: ${0:.2f}", futaTax)); | ^ | = 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` --> FICA3.rs:60:46 | 60 | println!("{}", format!("Net Earnings: ${0:.2f}", netEarnings)); | ^ | = 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` --> FICA3.rs:61:56 | 61 | println!("{}", format!("Employer Contributions: ${0:.2f}", employerContributions)); | ^ | = 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 `args` in this scope --> FICA3.rs:18:5 | 18 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> FICA3.rs:20:3 | 20 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> FICA3.rs:23:24 | 23 | let annualWages:f64 = Utils.stodWithDefault(args[1], 0.0f64); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> FICA3.rs:23:46 | 23 | let annualWages:f64 = Utils.stodWithDefault(args[1], 0.0f64); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> FICA3.rs:24:23 | 24 | let annualTips:f64 = Utils.stodWithDefault(args[2], 0.0f64); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> FICA3.rs:24:45 | 24 | let annualTips:f64 = Utils.stodWithDefault(args[2], 0.0f64); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0425`.

Solution