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 6 of 6

Thread: how to make program of Depreciation using if statement and loops

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to make program of Depreciation using if statement and loops

    This is the condition that my instructor gave:

    with every year that goes by the price of the product decreases as follows:
    year 1=20%
    year 2=29%
    year 3=19.5%
    year 4=18.5%
    year 5=17.5%
    year 6=16.5%
    year 7=15.5%
    year 8=14.5%
    year 9=13.5%
    year 10=12.5%

    how can i make a program using these variables, using only if statement and loops....

    help please....


  2. #2
    Member vanDarg's Avatar
    Join Date
    Jan 2011
    Location
    Chicago
    Posts
    65
    My Mood
    Mellow
    Thanks
    1
    Thanked 7 Times in 7 Posts

    Default Re: how to make program of Depreciation using if statement and loops

    What have you tried? Besides the first 3 years, the depreciation seems pretty simple (1%). What are you having trouble with?
    "Everything should be made as simple as possible, but not simpler."
    Asking Questions for Dummies | The Java Tutorials | Java Coding Styling Guide

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: how to make program of Depreciation using if statement and loops

    Welcome to the forum Pulsifier.

    You have posted in the What's wrong with my code forum but you have not posted any code.

    Do you know how to use loops and if statements?

    http://www.javaprogrammingforums.com...ava-loops.html

    The if-then and if-then-else Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  4. #4
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to make program of Depreciation using if statement and loops

    Quote Originally Posted by JavaPF View Post
    Welcome to the forum Pulsifier.

    You have posted in the What's wrong with my code forum but you have not posted any code.

    Do you know how to use loops and if statements?

    http://www.javaprogrammingforums.com...ava-loops.html

    The if-then and if-then-else Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)

    That's the problem good Sir.... It's our first week of classes, she haven't taught us anything yet.... so the answer is no... no idea on how to use loop and if statements... sorry

  5. #5
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to make program of Depreciation using if statement and loops

    I have an idea on the first 2 years.. its just that she wants us to get the result of the first year and implement it to the second year, second year's result implement it to the third year and so on....

  6. #6
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,514
    My Mood
    Grumpy
    Thanks
    0
    Thanked 165 Times in 156 Posts

    Default Re: how to make program of Depreciation using if statement and loops

    Have you learnt arrays? Placing the rates in an array would make things simpler.

Similar Threads

  1. how do i make 'variable' + 1 a statement
    By knoxy5467 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 11th, 2011, 12:07 PM
  2. program loops never ending
    By Ccogh05 in forum Loops & Control Statements
    Replies: 5
    Last Post: February 24th, 2011, 12:42 AM
  3. Loops only on the first statement
    By Liuric in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 2nd, 2010, 07:36 AM
  4. Program without loops and recursion
    By jayaram in forum Algorithms & Recursion
    Replies: 7
    Last Post: April 1st, 2010, 09:02 AM
  5. Program with for loops help
    By ixjaybeexi in forum Loops & Control Statements
    Replies: 23
    Last Post: October 8th, 2009, 10:05 AM