Hey,
Im writing an interest program for in java and i ahve a question about an easier method to obtain the user input. I have to get the amount the user wishes to input, the % interest, the annual rate (36 months, or 2 years ) and the compound rate ( monthly, daily, yearly). I need a better way to find out if the user has inputed 36 months or 2 years, same thing with the compound rate. As it is now, im using ALOT of if statements, there has to be a better way.

Recommended Answers

All 2 Replies

You could create methods that return different values based upon the input, but you still need if statements to do that. Would it be possible for me to see what you have? It would be much easier for me to help.

... an easier method to obtain the user input.

easier compared to what? and what do you have to test on? perhaps you do need all those if's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.