Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: how to code this in java?

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to code this in java?

    Hi,
    i am a beginner in java (just learning As and Bs of Java programming).
    I have given this instruction to code this in Java but i have no idea what to do.
    I'm only thinking i could use while loop and system.out.println(). But no idea how.
    help?Please
    Here is the instruction:
    Make a Selection (1 … 5)

    1. Make a Deposit
    2. Make a Withdrawal
    3. Show Account Balance
    4. Calculate Loan Payment
    5. Exit

    The user will start with a 0 balance. If the user presses 1 then you will prompt the user to enter in the amount of the deposit , add it to the balance, and display the balance. If the user presses 2 you will prompt the user to enter in the amount, subtract it from the balance, and display the balance. If the user presses 3 you will display the balance. If the user presses 4 you will prompt the user to enter in the loan amount, down payment (if any), the number of months, and the interest rate (i.e. .05 for 5%). You will then calculate the monthly payment and display it. If the user presses 5 you will end the program and say “Thank you! Please come again”. After each selection, you will do the appropriate work and then display the full menu again (without the Welcome sign). The exception is if the user presses 5. Do not display the menu again.

    The car payment can be calculated by:

    P ( r / 12 )
    -------------------------
    -m
    (1 - ( 1 + (r / 12 )) )

    For example, a 3 year (36 month) loan of $15,000 at 7% interest would look like this:

    15000 ( 0.07/ 12 )
    ------------------------------
    -36
    (1 - ( 1 + (0.07 / 12 )) )

    Where

    P = Loan Amount - Down payment
    r = Annual Interest rate
    n = Term (# of months for loan repayment. For example, a 5 year loan is 60 months)

    For example, if the loan amount was 11000 and the down-payment was 1000 then the P = 10000
    The interest rate was 7% so use .07
    The term was 5 years so use 60

    10000 * ( 0.07 / 12)
    --------------------------------
    (1 - ((1 + .07 / 12) ^ -60))


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: how to code this in java?

    Recommendations:
    1. First learn Java.
    2. Then write the code.


    Seriously, you must at least attempt to solve this first before just dumping your assignment here. Let's see your mistakes if we're going to have a chance of being able to help you. Also understand that learning Java will require enormous effort on your part, there's nothing easy about starting out with programming, but with patience and effort it will be worth it.

  3. #3
    Member
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    54
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default Re: how to code this in java?

    You'll need to print to the console in some way, such as through println and you're going to need a loop (maybe more than one, maybe not), however, you're going to need a lot more still. There's multiple ways to approach this problem. The first portion of figuring out how to make a program is to map out the logic and any field variables and methods you'll need. This should be done before even loading up your IDE. Once you have that figured out, then open the IDE and start transforming your layout and logic into Java.

Similar Threads

  1. Trouble Porting my Java File Reading Code to Android Code
    By Gravity Games in forum Android Development
    Replies: 0
    Last Post: December 6th, 2012, 04:38 PM
  2. Replies: 5
    Last Post: November 14th, 2012, 10:47 AM
  3. Replies: 3
    Last Post: September 3rd, 2012, 11:36 AM
  4. problem in my code java code graph editeur
    By kisokiso in forum Java Theory & Questions
    Replies: 5
    Last Post: January 6th, 2012, 08:36 AM
  5. Replies: 10
    Last Post: April 5th, 2011, 09:09 AM