It’s been a while, but I’ve finally found some time to post again. In my last post I showed the basic structure of a DLL for the engine of an RPN Calculator in response to Prashant’s 6th exercise. In this post I’ll start to look at the details.
15 September, 2010
01 August, 2010
Exercise 6 (part 1) – Multi-file DLL project
For his 6th exercise, Prashant suggests writing a
Scientific calculator supporting addition, subtraction, multiplication, division, square-root, square, cube, sin, cos, tan, Factorial, inverse, modulus.
In planning my solution to this exercise, I thought it would be cool to write a DLL (a Class Library in .NET parlance) to be the core engine of the calculator, and then write a console-based front-end. Later, when I’m learning WPF I can write a graphical front-end to the same DLL.
13 July, 2010
Exercise 5 – Reynolds again: overflow without exception
The 5th of Prashant’s 15 Exercises for Learning a new Programming Language builds directly onto the 4th:
Modify the above program such that it will ask for 'Do you want to calculate again (y/n),
if you say 'y', it'll again ask the parameters. If 'n', it'll exit. (Do while loop)While running the program give value mu = 0. See what happens. Does it give 'DIVIDE BY ZERO' error?
Does it give 'Segmentation fault..core dump?'. How to handle this situation. Is there something built
in the language itself? (Exception Handling)
The first bit is easy, the second bit may be surprising. First thing I’ll do is show you what happens when I run the program from last time with mu = 0.
Exercise 4 – Reynold’s Number: a basic class
The fourth of Prashant's exercises is:
Reynolds number is calculated using formula (D*v*rho)/mu Where D = Diameter, V= velocity, rho = density mu = viscosity
Write a program that will accept all values in appropriate units (Don't worry about unit conversion)
If number is < 2100, display Laminar flow,
If it’s between 2100 and 4000 display 'Transient flow' and
if more than '4000', display 'Turbulent Flow' (If, else, then...)
In working this solution I decided to declare a class to help in the calculation. The solution also shows some details of reading input from the console.
07 July, 2010
More learning references
As I’ve been working on learning C# and .NET in the last couple of weeks, I’ve come across a number of useful references beyond the tutorials and other things I list in my second post. They range from books, to posters, to podcasts, and I’ll briefly look at them in this post.