I figured I'd take what I've learnt so far and try making a simple calculator program... It works, but I'm sure there most be a more straightforward way of doing this. Any advice / suggestions would be greatly appreciated.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Ben Poland wrote:So, here's a calculator that the entire calculation would be on a single input, not number - enter - next number etc... This seems to work fine
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ben Poland wrote:Also, is there ever a need to use float instead of double? There seems no obvious reason to do so.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ben Poland wrote:I'll try the binary function suggestion, after I read about it that is
Again though, thank you so much for the help.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
All things are lawful, but not all things are profitable.
Ben Poland wrote:if characters are not entered in the right case.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Char variable is more than a single character, although the userInput is only a p or s.
All things are lawful, but not all things are profitable.
Ben Poland wrote:And worry not, Winston, I'm not using x instead of *, that was just me typing when over tired and forgetting that my brain needs a break sometimes
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
All things are lawful, but not all things are profitable.
Ben Poland wrote:So just to make sure I'm at least looking in the right direction, I should be writing another class and from within that class have methods running parts of the program and then refer back to it rather than writing line to line ("monolithic" ;) ) style code?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ben Poland wrote:So just to make sure I'm at least looking in the right direction, I should be writing another class and from within that class have methods running parts of the program...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
All things are lawful, but not all things are profitable.
Ben Poland wrote: is there ever a need to use float instead of double?
As far as I am concerned, a float is an affliction which should be avoided unless some API, e.g. this forces you to use it. I am also not convinced that changing doubles to floats improves precision. A better way to rotate images is (probably) to copy the Graphics object:-I have not had problems with rotation; it is shear that causes problems with arithmetic.Ben Poland wrote:. . . Also, is there ever a need to use float instead of double? There seems no obvious reason to do so.
Thanks,
Ben
Get me the mayor's office! I need to tell her about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|