Welcome to Dream.In.Code
Become a Java Expert!

Join 150,375 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,627 people online right now. Registration is fast and FREE... Join Now!




Please help me...

 
Reply to this topicStart new topic

Please help me...

maya_2008
19 Feb, 2008 - 06:29 PM
Post #1

New D.I.C Head
*

Joined: 19 Feb, 2008
Posts: 1

hello.. I am having a bit of trouble understanding my assingment.. i'll show it to you, and if you understand anything can anyone please tell me what is it?! and how do you do it!!??.. please.. i really need to know..


Write a Java program called MaxMin that prompts the user to enter three integers. The program finds the minimum and maximum values that were entered, and prints the result. Here is an example of the output produced by such a program:

Enter three integers: 17 2 2439
The minimum value is 2
The maximum value is 2439

When you are using the Scanner class and its nextInt method, the method looks for either a space or a newline character to indicate the end of an integer input. Thus you can enter all three integers on one line, and call the nextInt method three times to get the input values. Alternatively, the user can press "Enter" after each integer.

Write a Java program that displays the growth in value of an investment over a number of years. The investment pays a fixed interest rate. Interest is calculated once a year. The interest is compounded -- i.e. in the second year, the interest is calculated not only on the initial amount, but also on the interest that was paid in the first year. The program should prompt the user to enter the initial value of the investment (called the principal), the annual interest rate in percent, and the number of years (callled the term). It then displays a table with two columns, with a heading for each column, and showing the value of the investment after each year.

Thanks, hope someone will sure understand.. please reply ASAP!...
User is offlineProfile CardPM
+Quote Post

capty99
RE: Please Help Me...
19 Feb, 2008 - 07:30 PM
Post #2

the real kya
Group Icon

Joined: 26 Apr, 2001
Posts: 9,259



Thanked: 16 times
Dream Kudos: 550
My Contributions
Just so you know alot of the programmers don't respond to the ASAP. They are professionals who give of their time to donate some knowledge to the community, not to fix your hw.

Just getting that out of the way so you can have a better experience here.

what exactly are you not understanding,
i need some idea of where you are and what code you have to get you there,

your first one is pretty much just creating a scanner object

use the format
CODE

Scanner (name of object) = new Scanner(System.in);


then from that you use the method nextInt 3 times, and find the min and max of what you found.

since this is real simple, you can probably just use if statements.

so ,
take the first number a user inputs and set it to both your minimum and maximum value.

then , take the next number, and if it is greater than your first number, reset your max value, else if it is less than your first number replace the minimum value

then take your third number and if it is greater than your max value, replace the max value, and if it is less than your min value replace your min value.

then print max and min.

User is online!Profile CardPM
+Quote Post

Mavirick
RE: Please Help Me...
19 Feb, 2008 - 08:39 PM
Post #3

D.I.C Head
**

Joined: 18 Feb, 2008
Posts: 59



Thanked: 7 times
My Contributions
It seems to me you're actually asking about two assignments, seeing as the min and max which capty explained has no significance to a program that calculates interest rates.

The formula for calculated compounded interest is:

A = P (1 + r/n)^(nt)

Where A is the total amount paid after interest is calculated in, P is the principal (starting amount), r is the rate (if given in percent then divide by 100), n is the number of compounding periods (in your case, 1, because of once a year), and t is the number of years.

Note: if you want the growth factor and not the amount paid after interest calculated in, then don't multiply by P.
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Please Help Me...
19 Feb, 2008 - 09:54 PM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,660



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
I wanted to mention that this calculated interest assignment has been covered many times before here in the Java forum. So I would suggest you do a search for the keywords "interest" and you will see several which I have even helped on by providing full program code for.

Capty99 was right on the money with his solution for your first assignment.... and about the ASAP.

Good luck! smile.gif


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:01PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month