-
Notifications
You must be signed in to change notification settings - Fork 0
Add Cursor AI coding workflow enhancements #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
YashBangeraXR
wants to merge
1
commit into
main
Choose a base branch
from
test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<!-- 3075674a-d8ff-42c4-9ab2-45b044ce3b25 281033a6-8c0c-431d-94b1-812cae00e512 --> | ||
# Scientific Calculator Implementation Plan | ||
|
||
## Overview | ||
|
||
Extend the existing calculator architecture in `Models/` to add scientific computing capabilities, following the project's C# coding standards with `m_` prefix for private fields, `#region` blocks, and XML documentation. | ||
|
||
## Implementation Steps | ||
|
||
### 1. Create Scientific Calculator Interface | ||
|
||
**File**: `Models/IScientificCalculator.cs` | ||
|
||
- Extend `ICalculator` interface | ||
- Add methods for scientific operations: | ||
- Trigonometric: `Sin()`, `Cos()`, `Tan()`, `Asin()`, `Acos()`, `Atan()` | ||
- Logarithmic: `Log()`, `Log10()`, `Ln()` | ||
- Power/Root: `Power()`, `SquareRoot()`, `CubeRoot()`, `NthRoot()` | ||
- Other: `Factorial()`, `Absolute()`, `Modulus()` | ||
- Constants: Properties for `Pi`, `E` | ||
|
||
### 2. Implement Scientific Calculator | ||
|
||
**File**: `Models/ScientificCalculator.cs` | ||
|
||
- Inherit from `Calculator` class | ||
- Implement `IScientificCalculator` interface | ||
- Use proper `#region` blocks (Private Fields, Constructors, Public Methods, Private Methods) | ||
- Add angle mode support (Degrees/Radians) with private field `m_angleMode` | ||
- Implement all scientific operations using `System.Math` | ||
- Include proper error handling (negative factorial, domain errors for trig) | ||
- Record operations in history (inherited from base) | ||
- Add XML documentation for all public methods | ||
|
||
### 3. Create Console Application | ||
|
||
**File**: `Demo/ScientificCalculatorApp.cs` | ||
|
||
- Create console UI with menu system | ||
- Display available operations grouped by category (Basic, Trigonometric, Logarithmic, Power/Root, Other) | ||
- Input validation for numbers and operation selection | ||
- Support for angle mode toggle (Degrees/Radians) | ||
- Display memory and history features | ||
- Exit option | ||
- Use proper `#region` blocks and follow naming conventions | ||
|
||
### 4. Create Comprehensive Unit Tests | ||
|
||
**File**: `Tests/ScientificCalculatorTests.cs` | ||
|
||
- Follow test naming: `MethodName_StateUnderTest_ExpectedBehavior` | ||
- Use Arrange-Act-Assert pattern | ||
- Test categories: | ||
- **Basic Operations**: Verify inherited Add/Subtract/Multiply/Divide still work | ||
- **Trigonometric Tests**: Test Sin/Cos/Tan in both degrees and radians, edge cases (0, 90, 180, 360 degrees) | ||
- **Inverse Trigonometric Tests**: Test Asin/Acos/Atan with valid ranges | ||
- **Logarithmic Tests**: Test Log/Log10/Ln with positive numbers, verify domain errors for negative/zero | ||
- **Power/Root Tests**: Test Power, SquareRoot, CubeRoot, NthRoot with various inputs | ||
- **Factorial Tests**: Test positive integers, zero, verify error for negatives | ||
- **Angle Mode Tests**: Verify degree/radian conversions work correctly | ||
- **Memory Tests**: Verify memory operations inherited from base | ||
- **History Tests**: Verify scientific operations are recorded | ||
- **Error Handling Tests**: Test all exception scenarios | ||
|
||
### 5. Update Existing Files (if needed) | ||
|
||
- Add namespace references if required | ||
- No changes to existing `ICalculator` or `Calculator` to maintain backward compatibility | ||
|
||
## Key Design Decisions | ||
|
||
- **Inheritance**: `ScientificCalculator` extends `Calculator` to reuse memory and history functionality | ||
- **Interface Hierarchy**: `IScientificCalculator` extends `ICalculator` for polymorphism | ||
- **Angle Handling**: Default to Radians, provide mode toggle, convert internally when needed | ||
- **Constants**: Expose `Math.PI` and `Math.E` as properties for convenience | ||
- **Error Handling**: Use specific exceptions (`ArgumentException`, `ArgumentOutOfRangeException`) with clear messages | ||
|
||
## Files to Create | ||
|
||
1. `Models/IScientificCalculator.cs` - Interface definition | ||
2. `Models/ScientificCalculator.cs` - Implementation (~200-250 lines) | ||
3. `Demo/ScientificCalculatorApp.cs` - Console application | ||
4. `Tests/ScientificCalculatorTests.cs` - Comprehensive unit tests (~500-600 lines) | ||
|
||
### To-dos | ||
|
||
- [ ] Create IScientificCalculator interface extending ICalculator with scientific operation methods | ||
- [ ] Implement ScientificCalculator class with all scientific operations, angle mode support, and error handling | ||
- [ ] Build console application with menu system for scientific calculator operations | ||
- [ ] Create comprehensive unit tests covering all scientific operations, edge cases, and error handling |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested test naming convention uses underscores, but C# best practices recommend PascalCase for test method names like
MethodNameStateUnderTestExpectedBehavior
or using the Given_When_Then pattern.Copilot uses AI. Check for mistakes.