ClassicCalculator 1.0.0
See the version list below for details.
dotnet add package ClassicCalculator --version 1.0.0
NuGet\Install-Package ClassicCalculator -Version 1.0.0
<PackageReference Include="ClassicCalculator" Version="1.0.0" />
<PackageVersion Include="ClassicCalculator" Version="1.0.0" />
<PackageReference Include="ClassicCalculator" />
paket add ClassicCalculator --version 1.0.0
#r "nuget: ClassicCalculator, 1.0.0"
#addin nuget:?package=ClassicCalculator&version=1.0.0
#tool nuget:?package=ClassicCalculator&version=1.0.0
Classic Calculator
A classic calculator engine that responds to pressing buttons and provides output including display value.
Table of Contents
Description
It's a simple library that enables the user to create a calculator application or functionality without implementing any of the internal logic on their own. All they have to provide is a user interface that calls the library in response to user actions (e.g. pressing buttons) and presents the display value.
Features
The following actions/buttons are currently supported:
- Digits (0-9)
- Decimal point (.)
- Toggle sign (+/-)
- Add (+)
- Subtract (-)
- Multiply (*)
- Divide (/)
- Calculate/Equals (=)
- Percent (%)
- Sqaure root (√)
- Clear (C)
At the moment the only output is the display value but more details will be returned in the future versions.
When creating the calculator object, the user must provide the display length in the constructor which specifies how many digits can be displayed. This will affect the calculator in the same way as it normally does on the physical devices:
- User input is limited to the display length
- An error occurs when the integer part of the display value is too large to fit in the display
- The least meaningful digits of the decimal part of the display value are truncated to fit in the display
The user can also provide a logger object in the constructor that will be used internally by the library.
Missing functionality:
- Memory features (M+, M-, etc.)
- CE (clear last entry)
- Other features of more advanced calculators
Usage
An example usage:
var calculator = new Calculator(9); // Display can show up to 9 digits (DisplayValue = 0)
calculator.PressButton(CalculatorButton.One) // (DisplayValue = 1)
calculator.PressButton(CalculatorButton.Add) // (DisplayValue = 1)
calculator.PressButton(CalculatorButton.Five) // (DisplayValue = 5)
calculator.PressButton(CalculatorButton.Equals) // (DisplayValue = 6)
var displayValue = calculator.DisplayValue;
For more details, please refer to the provided documentation.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- DecimalMath.DecimalEx (>= 1.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial version of the library.