6. Scientific calculator supporting addition, subtraction, multiplication, division, square-root, square, cube, sin, cos, tan, Factorial, inverse, modulus
This is a fairly simple implementation of a console calculator. It only takes 2 number expressions ( ex: 1 + 1 ) as well as / commands for most other functions, except factorial ( n! ). Very little error checking is being done. All sorts of invalid inputs will cause this to throw exceptions.
posted by dharh 8:46 PM Nov 29th, 2009
4. 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...)
5. 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)
posted by dharh 3:01 AM Nov 29th, 2009
3. Accepting series of numbers, strings from keyboard and sorting them ascending, descending order.
posted by dharh 1:40 AM Nov 29th, 2009
2. Fibonacci series, swapping two variables, finding maximum/minimum among a list of numbers.
posted by dharh 12:47 AM Nov 29th, 2009
It's been a while since I've made an actual post, but I felt the urge. I do alot of programming (many different languages), so after I read this interview I thought i'd share it.
posted by dharh 1:05 PM Aug 7th, 2009
Using session variables instead of cookies?! Awesome.
posted by dharh 9:01 AM May 13th, 2008
As you can see the Java implementation of Step 1 of 15 Exercises for Learning a new Programming Language was more complicated than the C# implementation. This was largely due to one factor. You can't poll whether someone is typing from the console in Java.
The second problem is that you can't use a KeyEvent handler in the console, which would the second easiest solution to attempt.
Finally a third problem is that by using an event handler you essentially need to use threading so that the loop doesn't interfere with the handler and you are able to interrupt properly.
If there are better solutions I'd be very interested to see them.
posted by dharh 7:15 PM Feb 10th, 2008
« Previous 1 2 3 4 Next »