Here is my very first stab at writing a web service. It is a web service that utilises a class that i wrote for automating long division calculation. It is coded in C#. I felt such an application is a perfect way to introduce and familiarize myself to ASP.NET.
In school long division was common and useful back in the day for dividing very large numbers when a calculator was not available or allowed. However, it was always a pain to use and the calculations always took a while to work out, especially if the numbers were very large.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGeW4HIsU8yVOl89TRBGYyztEvV3Jdddxn8OBRZgPVawyh-aWdpzpllrHpZTnxYWHV_5R8uL8jVBpjKXjiavRFKjeVIxIYOb6gflUeMfFW2Z88_bOM0OlsM-v2P-q3mbC54CAoHA26w/s320/longdivision+input-form.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv0LDWWu6Ni6Zha9az3Zqp7I0jkXvNNqN_BdVVKRTPxV1r9kvUVCxky9yZS7kgT6Qn1BLwfNGMzJHzp363mbqmtMoMngU2BTqR7EhR5zhRH5UOo5ROyxpKUoa2euQA0yTiqxOjENuoPQ/s320/longdivision-app-output.jpg)
Basically we have a divisor and dividend. My application takes both these numbers as input, validates them and produces an automated end result showing the workings (just like it would be done manually by hand). The below is the input screen:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGeW4HIsU8yVOl89TRBGYyztEvV3Jdddxn8OBRZgPVawyh-aWdpzpllrHpZTnxYWHV_5R8uL8jVBpjKXjiavRFKjeVIxIYOb6gflUeMfFW2Z88_bOM0OlsM-v2P-q3mbC54CAoHA26w/s320/longdivision+input-form.jpg)
When the calculate button is pressed with the two input values in place, the result is generated and presented to the user (as a PNG image). Below is what the user will see.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv0LDWWu6Ni6Zha9az3Zqp7I0jkXvNNqN_BdVVKRTPxV1r9kvUVCxky9yZS7kgT6Qn1BLwfNGMzJHzp363mbqmtMoMngU2BTqR7EhR5zhRH5UOo5ROyxpKUoa2euQA0yTiqxOjENuoPQ/s320/longdivision-app-output.jpg)
I use the System.Drawing namespace to draw the output. This is drawn onto a bitmap and then converted to a PNG image suitable for view in a browser. The drawing of the output makes anything we are displaying more readable and presentable (especially any output data). Also, it enables us to draw the division lines and vertical lines etc.
I felt this application is quite useful and original in a sense because i have not seen any web services on the net at the current moment that automates LongDivision. The source code can be downloaded here if anyone is keen on seeing how it works.