# Developed a Quadratic Math App using C# and WinForms

# Background

I learned Quadratics last year (during virtual learning) and it was really fun but also somewhat difficult to grasp. At the time, I got so much homework I couldn't find time to code, but now my homework has been reduced and I get time to code.

I remembered my struggles from last year and wanted to help others who are struggling with quadratics. So I made [this Windows Forms App](https://github.com/saisiddhish/quadratic-mathapp) (yes it's an exe file and Macs can't run it) that can solve quadratic equations in the format of \\( ax^2 + bx + c \\) and can help you practice them by generating a quadratic equation and allowing you to answer it.

# About the project

This project is called the Quadratics Math App. In this app, you can solve quadratic equations you have and can practice with automatically generated ones.  
It was fun learning Regex to help with the parts of it that needed pattern checking. It was also fun testing it. One challenge was actually implementing the quadratic-solving function as originally it was partially accurate. For example, if the quadratic had no solutions it still gave random decimals.

# How it works

This is what the app looks like:

![Quadratic App UI](https://cdn.hashnode.com/res/hashnode/image/upload/v1649006408123/48t7p51-V.jpg align="left")

## App - Left Side

![Quadratic App Left Side](https://cdn.hashnode.com/res/hashnode/image/upload/v1649006484284/HkfYanZEZ.jpg align="left")

This side of the app is the Quadratic Solver. You enter your \\( a \\) , \\( b \\) , and \\( c \\) values and it goes through the quadratic formula, \\( x = \frac{-b\pm\sqrt{b^2-4ac}}{2a} \\) , and returns your (usually) two results.

Did I mention? It live updates the equation you type, like this:

![Live Update Feature](https://cdn.hashnode.com/res/hashnode/image/upload/v1649007023777/hIZ5l2mOY.jpg align="left")

## App - Right Side

![Quadratic App Right Side](https://cdn.hashnode.com/res/hashnode/image/upload/v1649007486076/Q-kpWgfN4.jpg align="left")

On the right side is the Quadratic Practice. You press the "Generate Problem" button

![Generate Problem Button](https://cdn.hashnode.com/res/hashnode/image/upload/v1649007075062/eOFyKJ8Qb.jpg align="left")

And *poof* in the "Equation will be here" textbox

![Equation will be here textbox](https://cdn.hashnode.com/res/hashnode/image/upload/v1649007136926/xA74wLQNR.jpg align="left")

Your randomly generated equation appears.

Then you do the math, and you put in your answers in the "Ans 1" and "Ans 2" textboxes (take your fractions to convert them to decimals, and round to the nearest thousandths place).

![Ans 1 and Ans 2 textboxes](https://cdn.hashnode.com/res/hashnode/image/upload/v1649007335973/4gFBYcZKa.jpg align="left")

Then press the "Submit All" button.

![Submit All button](https://cdn.hashnode.com/res/hashnode/image/upload/v1649007379126/stuXmpWEZ.jpg align="left")

The code will go through the Quadratic Formula and finds the correct answers then compares them to what you submitted to tell you if you are right or wrong (it also tells you what the right answer is). It also allows one right and one wrong answer (so don't worry one wrong answer won't make the whole thing wrong). Consider this example below:

![Quadratic Solver example](https://cdn.hashnode.com/res/hashnode/image/upload/v1649007638055/XFm65v46b.jpg align="left")

GitHub Source Code: [https://github.com/saisiddhish/quadratic-mathapp](https://github.com/saisiddhish/quadratic-mathapp)  
**Note:** This is Windows Forms (WinForms) application, and will only run on Windows OS.

Hope this helps your Quadratic Problems!
