Project: Income Tax (Single Taxpayer)
US Income Tax is calculated based on brackets. Write a program that uses the tables below to calculate the 2020 income tax for single taxpayers. The program should accept one command line argument, the taxable income amount. Use IF/ELSE statements to do the tax computation.
Rate | Taxable Income Bracket | Tax Owed |
---|---|---|
10% |
$0 to $9,875 | 10% of Taxable Income |
12% |
$9,876 to $40,125 | Maximum tax from previous bracket plus 12% of the excess over $9,875 |
22% |
$40,126 to $85,525 | Maximum tax from previous bracket plus 22% of the excess over $40,125 |
24% |
$85,526 to $163,300 | Maximum tax from previous bracket plus 24% of the excess over $85,525 |
32% |
$163,301 to $207,350 | Maximum tax from previous bracket plus 32% of the excess over $163,300 |
35% |
$207,351 to $518,400 | Maximum tax from previous bracket plus 35% of the excess over $207,350 |
37% |
$518,401+ | Maximum tax from previous bracket plus 37% of the excess over $518,400 |
Source: [[Federal Income Tax Brackets]]
Output
$ rustc IncomeTax1.rs
error: unknown format trait `s`
--> IncomeTax1.rs:17:38
|
17 | println!("{}", format!("Syntax: {0:s} income", utils::program_name().expect("program name should not be empty!")));
| ^
|
= 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`
--> IncomeTax1.rs:54:52
|
54 | println!("{}", format!("Federal Income Tax: ${0:.2f}", incomeTax));
| ^
|
= 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
--> IncomeTax1.rs:15:12
|
15 | income = Utils.stodWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find function `exit` in this scope
--> IncomeTax1.rs:18:3
|
18 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
8 + use std::process::exit;
|
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:12:25
|
12 | let mut income:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
12 | let mut income:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:13:28
|
13 | let mut incomeTax:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
13 | let mut incomeTax:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:20:20
|
20 | if income <= 9875.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
20 | if income <= 9875.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:23:21
|
23 | incomeTax += 9875.f64 * 0.10f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
23 | incomeTax += 9875.0f64 * 0.10f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:24:22
|
24 | if income <= 40125.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
24 | if income <= 40125.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:25:32
|
25 | incomeTax += (income - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
25 | incomeTax += (income - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:24
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.0f64 - 9875.f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:35
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.f64 - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:28:23
|
28 | if income <= 85525.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
28 | if income <= 85525.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:29:34
|
29 | incomeTax += (income - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
29 | incomeTax += (income - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:25
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.0f64 - 40125.f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:37
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.f64 - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:32:25
|
32 | if income <= 163300.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
32 | if income <= 163300.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:33:35
|
33 | incomeTax += (income - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
33 | incomeTax += (income - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:27
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.0f64 - 85525.f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:39
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.f64 - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:36:26
|
36 | if income <= 207350.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
36 | if income <= 207350.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:37:37
|
37 | incomeTax += (income - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
37 | incomeTax += (income - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:28
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.0f64 - 163300.f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:41
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.f64 - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:40:27
|
40 | if income <= 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
40 | if income <= 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:41:38
|
41 | ... incomeTax += (income - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
41 | incomeTax += (income - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:29
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.0f64 - 207350.f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:42
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.f64 - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:44:27
|
44 | ... if income > 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
44 | if income > 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:45:39
|
45 | ... incomeTax += (income - 518400.f64) * 0.37f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
45 | incomeTax += (income - 518400.0f64) * 0.37f64;
| +
error: aborting due to 30 previous errors
Some errors have detailed explanations: E0425, E0610.
For more information about an error, try `rustc --explain E0425`.
$ rustc IncomeTax1.rs
error: unknown format trait `s`
--> IncomeTax1.rs:17:38
|
17 | println!("{}", format!("Syntax: {0:s} income", utils::program_name().expect("program name should not be empty!")));
| ^
|
= 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`
--> IncomeTax1.rs:54:52
|
54 | println!("{}", format!("Federal Income Tax: ${0:.2f}", incomeTax));
| ^
|
= 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
--> IncomeTax1.rs:15:12
|
15 | income = Utils.stodWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find function `exit` in this scope
--> IncomeTax1.rs:18:3
|
18 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
8 + use std::process::exit;
|
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:12:25
|
12 | let mut income:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
12 | let mut income:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:13:28
|
13 | let mut incomeTax:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
13 | let mut incomeTax:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:20:20
|
20 | if income <= 9875.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
20 | if income <= 9875.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:23:21
|
23 | incomeTax += 9875.f64 * 0.10f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
23 | incomeTax += 9875.0f64 * 0.10f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:24:22
|
24 | if income <= 40125.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
24 | if income <= 40125.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:25:32
|
25 | incomeTax += (income - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
25 | incomeTax += (income - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:24
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.0f64 - 9875.f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:35
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.f64 - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:28:23
|
28 | if income <= 85525.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
28 | if income <= 85525.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:29:34
|
29 | incomeTax += (income - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
29 | incomeTax += (income - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:25
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.0f64 - 40125.f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:37
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.f64 - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:32:25
|
32 | if income <= 163300.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
32 | if income <= 163300.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:33:35
|
33 | incomeTax += (income - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
33 | incomeTax += (income - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:27
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.0f64 - 85525.f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:39
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.f64 - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:36:26
|
36 | if income <= 207350.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
36 | if income <= 207350.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:37:37
|
37 | incomeTax += (income - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
37 | incomeTax += (income - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:28
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.0f64 - 163300.f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:41
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.f64 - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:40:27
|
40 | if income <= 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
40 | if income <= 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:41:38
|
41 | ... incomeTax += (income - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
41 | incomeTax += (income - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:29
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.0f64 - 207350.f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:42
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.f64 - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:44:27
|
44 | ... if income > 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
44 | if income > 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:45:39
|
45 | ... incomeTax += (income - 518400.f64) * 0.37f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
45 | incomeTax += (income - 518400.0f64) * 0.37f64;
| +
error: aborting due to 30 previous errors
Some errors have detailed explanations: E0425, E0610.
For more information about an error, try `rustc --explain E0425`.
$ rustc IncomeTax1.rs
error: unknown format trait `s`
--> IncomeTax1.rs:17:38
|
17 | println!("{}", format!("Syntax: {0:s} income", utils::program_name().expect("program name should not be empty!")));
| ^
|
= 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`
--> IncomeTax1.rs:54:52
|
54 | println!("{}", format!("Federal Income Tax: ${0:.2f}", incomeTax));
| ^
|
= 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
--> IncomeTax1.rs:15:12
|
15 | income = Utils.stodWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find function `exit` in this scope
--> IncomeTax1.rs:18:3
|
18 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
8 + use std::process::exit;
|
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:12:25
|
12 | let mut income:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
12 | let mut income:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:13:28
|
13 | let mut incomeTax:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
13 | let mut incomeTax:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:20:20
|
20 | if income <= 9875.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
20 | if income <= 9875.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:23:21
|
23 | incomeTax += 9875.f64 * 0.10f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
23 | incomeTax += 9875.0f64 * 0.10f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:24:22
|
24 | if income <= 40125.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
24 | if income <= 40125.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:25:32
|
25 | incomeTax += (income - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
25 | incomeTax += (income - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:24
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.0f64 - 9875.f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:35
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.f64 - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:28:23
|
28 | if income <= 85525.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
28 | if income <= 85525.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:29:34
|
29 | incomeTax += (income - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
29 | incomeTax += (income - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:25
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.0f64 - 40125.f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:37
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.f64 - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:32:25
|
32 | if income <= 163300.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
32 | if income <= 163300.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:33:35
|
33 | incomeTax += (income - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
33 | incomeTax += (income - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:27
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.0f64 - 85525.f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:39
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.f64 - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:36:26
|
36 | if income <= 207350.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
36 | if income <= 207350.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:37:37
|
37 | incomeTax += (income - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
37 | incomeTax += (income - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:28
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.0f64 - 163300.f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:41
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.f64 - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:40:27
|
40 | if income <= 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
40 | if income <= 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:41:38
|
41 | ... incomeTax += (income - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
41 | incomeTax += (income - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:29
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.0f64 - 207350.f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:42
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.f64 - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:44:27
|
44 | ... if income > 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
44 | if income > 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:45:39
|
45 | ... incomeTax += (income - 518400.f64) * 0.37f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
45 | incomeTax += (income - 518400.0f64) * 0.37f64;
| +
error: aborting due to 30 previous errors
Some errors have detailed explanations: E0425, E0610.
For more information about an error, try `rustc --explain E0425`.
$ rustc IncomeTax1.rs
error: unknown format trait `s`
--> IncomeTax1.rs:17:38
|
17 | println!("{}", format!("Syntax: {0:s} income", utils::program_name().expect("program name should not be empty!")));
| ^
|
= 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`
--> IncomeTax1.rs:54:52
|
54 | println!("{}", format!("Federal Income Tax: ${0:.2f}", incomeTax));
| ^
|
= 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
--> IncomeTax1.rs:15:12
|
15 | income = Utils.stodWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find function `exit` in this scope
--> IncomeTax1.rs:18:3
|
18 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
8 + use std::process::exit;
|
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:12:25
|
12 | let mut income:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
12 | let mut income:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:13:28
|
13 | let mut incomeTax:f64 = 0.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
13 | let mut incomeTax:f64 = 0.0f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:20:20
|
20 | if income <= 9875.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
20 | if income <= 9875.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:23:21
|
23 | incomeTax += 9875.f64 * 0.10f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
23 | incomeTax += 9875.0f64 * 0.10f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:24:22
|
24 | if income <= 40125.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
24 | if income <= 40125.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:25:32
|
25 | incomeTax += (income - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
25 | incomeTax += (income - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:24
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.0f64 - 9875.f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:27:35
|
27 | incomeTax += (40125.f64 - 9875.f64) * 0.12f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
27 | incomeTax += (40125.f64 - 9875.0f64) * 0.12f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:28:23
|
28 | if income <= 85525.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
28 | if income <= 85525.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:29:34
|
29 | incomeTax += (income - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
29 | incomeTax += (income - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:25
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.0f64 - 40125.f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:31:37
|
31 | incomeTax += (85525.f64 - 40125.f64) * 0.22f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
31 | incomeTax += (85525.f64 - 40125.0f64) * 0.22f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:32:25
|
32 | if income <= 163300.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
32 | if income <= 163300.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:33:35
|
33 | incomeTax += (income - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
33 | incomeTax += (income - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:27
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.0f64 - 85525.f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:35:39
|
35 | incomeTax += (163300.f64 - 85525.f64) * 0.24f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
35 | incomeTax += (163300.f64 - 85525.0f64) * 0.24f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:36:26
|
36 | if income <= 207350.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
36 | if income <= 207350.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:37:37
|
37 | incomeTax += (income - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
37 | incomeTax += (income - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:28
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.0f64 - 163300.f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:39:41
|
39 | incomeTax += (207350.f64 - 163300.f64) * 0.32f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
39 | incomeTax += (207350.f64 - 163300.0f64) * 0.32f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:40:27
|
40 | if income <= 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
40 | if income <= 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:41:38
|
41 | ... incomeTax += (income - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
41 | incomeTax += (income - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:29
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.0f64 - 207350.f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:43:42
|
43 | ... incomeTax += (518400.f64 - 207350.f64) * 0.35f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
43 | incomeTax += (518400.f64 - 207350.0f64) * 0.35f64;
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:44:27
|
44 | ... if income > 518400.f64 {
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
44 | if income > 518400.0f64 {
| +
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> IncomeTax1.rs:45:39
|
45 | ... incomeTax += (income - 518400.f64) * 0.37f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
45 | incomeTax += (income - 518400.0f64) * 0.37f64;
| +
error: aborting due to 30 previous errors
Some errors have detailed explanations: E0425, E0610.
For more information about an error, try `rustc --explain E0425`.