Results 1 to 11 of 11
  1. #1
    Ghack is offline Member
    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Default [Help] About changing computing program (Java)

    Guys, i need help about something in Java. Im a newbie and i don't know nothing about it so i need u're help 'cuz i need that for a seminar paper.

    I have to change computing program to programming projects, u can see an example down there:

    1. Set the starting value of money.
    2. Subtract the maximum number of quarters from money, and print the quantity
    of quarters extracted.
    3. Subtract the maximum number of dimes from money, and print the quantity of
    dimes extracted.
    4. Subtract the maximum number of nickels from money, and print the quantity of
    nickels extracted.
    5. The remainder of money is printed as pennies.
    Here is how we might write the ¯rst step in Java:
    int dollars = 3;
    int cents = 46;
    int money = (dollars * 100) + cents;
    The second step of the algorithm is cleverly written as follows:
    System.out.println("quarters = " + (money / 25));
    money = money % 25;
    These statements exploit integer division, /, and integer modulo, %.
    In the ¯rst statement, money / 25 calculates the maximum number of quarters to
    extract from money. There are two important points:
    1. The integer division operator, /, calculates integer quotient|the number of
    times 25 can be subtracted from money without leaving a negative remainder. In
    the example, since money's cell holds 346, the quotient is 13, because a maximum
    of 13 quarters (13*25 = 325) can be wholly subtracted from 346 without leaving
    a negative remainder. Here are additional examples for intuition:
    ² 14 / 3 computes to 4 (and the remainder, 2, is forgotten)
    ² 6 / 3 computes to 2 (and there is no remainder)
    ² 4 / 5 computes to 0, because 5 cannot be wholly subtracted from 4
    2. The calculation of the division, money / 25, does not alter the value in money's
    cell, which remains 346|only an assignment statement can change the value in
    money's cell.
    The second statement, money = money % 25, deals with the second point just men-
    tioned: Since we have calculated and printed that 13 whole quarters can be extracted
    from the amount of money, we must reset the value in money's cell to the remainder.
    This can be done either of two ways:

    1. By the statement,
    money = money - ((money / 25) * 25);
    which calculates the monetary value of the extracted quarters and subtracts
    this from money.
    2. By the more elegant statement,
    money = money % 25;
    whose modulo operator, %, calculates the integer remainder of dividing money
    by 25 and assigns it to money. In this example, the remainder from performing
    346/25 is of course 21. Here are additional examples of computing remainders:
    ² 14 % 3 computes to 2
    ² 6 % 3 computes to 0
    ² 4 % 5 computes to 4
    The combination of the integer quotient and remainder operations calculates the
    correct quantity of quarters.

    Java Code:
    /** MakeChange calculates the change for the amounts in variables
    * dollars and cents. */
    public class MakeChange
    f public static void main(String[] args)
    f int dollars = 3;
    int cents = 46;
    int money = (dollars * 100) + cents;
    System.out.println("quarters = " + (money / 25));
    money = money % 25;
    System.out.println("dimes = " + (money / 10));
    money = money % 10;
    System.out.println("nickels = " + (money / 5));
    money = money % 5;
    System.out.println("pennies = " + money); 
         }
    }

    So, the semniar paper is this: Rebuild the change-making program, so that it uses a
    model that is this specification (watch the photo below):


    Last edited by Ghack; 01-04-2013 at 09:21 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: [Help] About changing computing program (Java)

    I see no image in your post above and no specific answerable question. What exactly do you need help with? The more specific your question, usually the better our answers will be.

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,563
    Rep Power
    25

    Default Re: [Help] About changing computing program (Java)

    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    Ghack is offline Member
    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Default Re: [Help] About changing computing program (Java)

    There is the photo, look at it

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,563
    Rep Power
    25

    Default Re: [Help] About changing computing program (Java)

    Do you have any specific questions about your program? Please ask them.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    Ghack is offline Member
    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Default Re: [Help] About changing computing program (Java)

    See that thing up there :/

  7. #7
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,563
    Rep Power
    25

    Default Re: [Help] About changing computing program (Java)

    Where are your questions?
    If you don't understand my response, don't ignore it, ask a question.

  8. #8
    Russd772 is offline Member
    Join Date
    Dec 2012
    Posts
    42
    Rep Power
    0

    Default Re: [Help] About changing computing program (Java)

    It sounds like your asking the people here to do your homework for you? unfortunatly thats not how it works, if your having trouble with a specific part of your homework and you have a legitimate question the people here are more than happy to help. First you have to try and do this on your own, and then ask questions about specific probems your having, otherwise you will not find much help here.

  9. #9
    Ghack is offline Member
    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Default Re: [Help] About changing computing program (Java)

    Quote Originally Posted by Russd772 View Post
    It sounds like your asking the people here to do your homework for you? unfortunatly thats not how it works, if your having trouble with a specific part of your homework and you have a legitimate question the people here are more than happy to help. First you have to try and do this on your own, and then ask questions about specific probems your having, otherwise you will not find much help here.
    I tryed but all of that was a horrible mistake, i told u that i'm really a newbie in this things and i do not know nothing about this, for that i ask u that question.

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: [Help] About changing computing program (Java)

    Quote Originally Posted by Ghack View Post
    I tryed but all of that was a horrible mistake, i told u that i'm really a newbie in this things and i do not know nothing about this, for that i ask u that question.
    You still haven't asked a question. Please know that no one is going to do your work for you. If you've tried a solution and it's not working, then please by all means show your code, show your errors, and ask your questions. If all you want is for someone to solve this for you, then please go elsewhere (though you'll likely get the same response on any programming forum).

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: [Help] About changing computing program (Java)

    Quote Originally Posted by Ghack View Post
    i do not know nothing about this
    Assuming that the double negative wasn't intended, here's where you can change that: The Java™ Tutorials

    Now, since this thread is going nowhere rather rapidly, I'm closing it. Feel free to start another thread when you can ask an answerable question on the lines of this web page: How to ask questions the smart way

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM
  2. [SOLVED] Changing the look of butons in program
    By linux1man in forum AWT / Swing
    Replies: 8
    Last Post: 03-14-2009, 06:04 PM
  3. Computing prime numbers in Java
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-12-2008, 08:39 PM
  4. distributed computing in java
    By pushpik in forum Advanced Java
    Replies: 0
    Last Post: 03-31-2008, 06:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •