Tax Calculator
If the state is "WI", then each order is taxed 5.5%. Otherwise, there is no tax. Write a program to calculate the total price, given the order amount and the state name.
This exercise can be solved with an if statement:
if state == "WI" {
const WI_TAX_RATE: f64 = 0.055;
let tax = WI_TAX_RATE * amount;
let total = tax + amount;
println!("The subtotal is ${amount:.2}.");
println!("The tax is ${tax:.2}.");
println!("The total is ${total:.2}.");
} else {
println!("The total is ${amount:2}.");
}