https://github.com/deividsantosr/purchase-calculator
Purchase calculator considering the selected state tax
https://github.com/deividsantosr/purchase-calculator
cli console-application csharp
Last synced: over 1 year ago
JSON representation
Purchase calculator considering the selected state tax
- Host: GitHub
- URL: https://github.com/deividsantosr/purchase-calculator
- Owner: deividsantosr
- Created: 2025-04-06T00:21:50.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-06T03:58:37.000Z (over 1 year ago)
- Last Synced: 2025-04-06T04:28:00.991Z (over 1 year ago)
- Topics: cli, console-application, csharp
- Language: C#
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
๏ปฟ# Purchase Calculator
A simple C# console application that calculates the total cost of a product based on the selected U.S. state and product type, applying tax rules according to the challenge specifications.
## ๐ Features
- List of predefined U.S. states with individual tax rates
- Product selection with predefined prices
- Automatic calculation of total cost including tax
- Clean and structured code using models, services, and interfaces
## ๐งช How to Run
1. Clone the repository:
```bash
git clone https://github.com/deividsantosr/purchase-calculator.git
cd purchase-calculator
```
2. Open the project with **Visual Studio** or run with .NET CLI:
```bash
dotnet run
```
## ๐ Project Structure
```
PurchaseCalculator/
โโโ Models/ # Domain models (Product, State)
โโโ Services/ # Business logic
โ โโโ Interfaces/ # Interfaces for service abstraction
โโโ Program.cs # Entry point of the application
โโโ PurchaseCalculator.csproj
โโโ .gitignore
```
## ๐ก Example
Input:
```bash
=== PURCHASE CALCULATOR ===
Select your state (type the number):
1 - California (0.08)
2 - Texas (0.08)
3 - New York (0.08)
4 - Florida (0.08)
5 - Washington (0.05)
6 - Oregon (0.05)
7 - Idaho (0.05)
8 - Utah (0.05)
9 - Montana (0.05)
10 - New Mexico (0.05)
11 - Arizona (0.05)
12 - Wyoming (0.05)
13 - Kansas (0.05)
14 - Arkansas (0.05)
15 - Georgia (0.05)
16 - Alabama (0.05)
17 - Lousiana (0.05)
18 - Alaska (0.00)
19 - Colorado (0.00)
20 - Delaware (0.00)
21 - Nevada (0.00)
22 - New Jersey (0.00)
23 - North Carolina (0.00)
24 - Ohio (0.00)
25 - Washington D.C (0.00)
State number: 3
You selected: New York (0.08)
Enter product details (or press ENTER to finish):
Enter product name: Computer
Enter product price: $200
Enter product name: Smartphone
Enter product price: $50
Enter product name: Keyboard
Enter product price: $15
Enter product name:
```
Output:
```bash
=== PURCHASE SUMMARY ===
Computer: $200.00
Smartphone: $50.00
Keyboard: $15.00
SUBTOTAL: $265.00
TAX: $21.20
TOTAL: $286.20
```
## ๐ Requirements
- [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download)
- Visual Studio 2022+ or any C#-compatible IDE