8000 GitHub - jonatandahora/tax_calculator
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jonatandahora/tax_calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tax Calculator

Overview

This is a Ruby application that calculates the total price and sales tax for a list of purchased items based on predefined tax rules.

Features

  • Applies a 10% sales tax to non-exempt items.
  • Applies a 5% import duty to imported goods.
  • Rounds tax amounts to the nearest 0.05.
  • Generates a receipt with itemized costs, total sales tax, and total price.
  • Includes an interactive mode for user input.
  • Contains RSpec tests to verify correctness.

Installation

Install RSpec for testing (if not already insta 6B3C lled):

gem install rspec

Usage

Interactive Mode

Run the script in the terminal:

ruby tax_calculator.rb

Enter your items in the following format:

<number> <item name> at <price>

Type done when finished. Example:

2 book at 12.49
1 music CD at 14.99
1 chocolate bar at 0.85
done

The receipt will be displayed as output.

Running Tests

To run the RSpec tests:

rspec spec/tax_calculator_spec.rb

This will validate the implementation against sample inputs.

Example Output

Input:

2 book at 12.49
1 music CD at 14.99
1 chocolate bar at 0.85
done

Output:

2 book: 24.98
1 music CD: 16.49
1 chocolate bar: 0.85
Taxes: 1.50
Total: 42.32

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0