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

Thread: Can someone help with my code and psuedocode.

  1. #1
    Junior Member Hazmat210's Avatar
    Join Date
    Feb 2012
    Location
    San Antonio,Tx
    Posts
    23
    My Mood
    Nerdy
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Can someone help with my code and psuedocode.

    I am new to programing and am taking intro to Java this semester. First project is program that determines least amount of bills and coins of a given amount. It is very basic and also was told to include the psuedocode in the code. Please any feedback is appreciated but please don't be to harsh.

    /*
    * Program will prompts for monetary value and display amount in bill and coins.
    * The total amount is entered in with keyboard.
    * Bills and coins are calculated by dividing total by bill amount and again with remaining balance divided so on and ...
    *
    * - Inputs:
    * totalamount in entered from keyboard.
    * 
    * - Processing:
    * totalamount is multiplied by 100 to convert to cents.
    * Value is then divided by 1000 to find amount of ten dollar bills in amount.
    * The remainder of operation is then divided by 500 to find amount of five dollar bills in amount.
    * The remainder of operation is then divided by 100 to find amount of one dollar bills in amount.
    * The remainder of operation is then divided by 25 to find amount of quarters in amount.
    * The remainder of operation is then divided by 10 to find amount of dimes in amount.
    * The remainder of operation is then divided by 5 to find amount of knickels in amount.
    *
    *
    *
    * - Outputs:
    * Display amount of ten dollar bills in totalamount.
    * Display amount of five dollar bills in totalamount.
    * Display amount of dollar bills in totalamount.
    * Display amount of quarters in totalamount.
    * Display amount of dimes in totalamount.
    * Display amount of pennies in totalamount.
    *
    * @author Robert Gonzalez
    * @version 1.1
    *
    */
    import java.util.Scanner;
    public class changeBack {
    /**
    * Calculates fewest number of each bill and coin needed to represent that input amount.
    * @param args A String array containing command-line parameters.
    */
    public static void main(String[] args)
    {
    double totalamount;
    double remainbalance;
    int tenbills;
    int fivebills;
    int dollars;
    int quarters;
    int dimes;
    int knickels;
    int pennies;
     
    Scanner input = new Scanner(System.in);
    //Get the total amount to calculate change
    System.out.print("How much money do you have in your pocket? ");
    totalamount = input.nextDouble();
     
    //Calculate amount of bills and coins
     
    totalamount =(totalamount*100);
    tenbills = (int) totalamount/1000;
    remainbalance = totalamount%1000;
    fivebills= (int)remainbalance/500;
    remainbalance = totalamount%500;
    dollars= (int)remainbalance/100;
    remainbalance = totalamount%100;
    quarters= (int)remainbalance/50;
    remainbalance = totalamount%50;
    dimes= (int)remainbalance/10;
    remainbalance = totalamount%10;
    knickels= (int)remainbalance/5;
    remainbalance = totalamount%5;
    pennies= (int)remainbalance;
     
     
    //Displays the outputs
    System.out.println("That amount brakes down to:");
    System.out.println(tenbills + " ten dollar bills");
    System.out.println(fivebills + " five dollars bills");
    System.out.println(dollars + " dollar bills");
    System.out.println(quarters + " quarters");
    System.out.println(dimes + " dimes");
    System.out.println(knickels + " knickels");
    System.out.println(pennies + " pennies");
    }
    }
    Last edited by Hazmat210; February 3rd, 2012 at 02:50 PM.


  2. #2
    Forum VIP
    Join Date
    Oct 2010
    Posts
    275
    My Mood
    Cool
    Thanks
    32
    Thanked 54 Times in 47 Posts
    Blog Entries
    2

    Default Re: Can someone help with my code and psuedocode.

    Hello, what is your actual problem? Are you having issues creating psuedocode? Psuedocode has many tutorials on how to do.

    Also, please wrap your code like so [code=Java]*Code here*[/code]

  3. The Following User Says Thank You to Tjstretch For This Useful Post:

    Hazmat210 (February 3rd, 2012)

  4. #3
    Junior Member Hazmat210's Avatar
    Join Date
    Feb 2012
    Location
    San Antonio,Tx
    Posts
    23
    My Mood
    Nerdy
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Re: Can someone help with my code and psuedocode.

    Thanks for the reply so essentially the psuedocode should have the same amount of lines as the code? I am new to forums and do not know the rules here I will wrap the code as soon as I figure out how.

  5. #4
    Junior Member
    Join Date
    Feb 2012
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Can someone help with my code and psuedocode.

    post with pseudo code guidelines, so that i can able to help you

  6. The Following User Says Thank You to kb18001 For This Useful Post:

    Hazmat210 (February 3rd, 2012)

  7. #5
    Junior Member Hazmat210's Avatar
    Join Date
    Feb 2012
    Location
    San Antonio,Tx
    Posts
    23
    My Mood
    Nerdy
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Re: Can someone help with my code and psuedocode.

    Sorry, professor asked us to include it at the very begining of our code. I am also not sure if the bills needs to be in the inputs.


    /*
    * Program will prompt for monetary value and display amount in bill and coins.
    * The total amount is entered in with keyboard.
    * Bills and coins are calculated by dividing total by bill amount and again with remaining balance divided so on and ...
    *
    * - Inputs:
    * totalamount in entered from keyboard.
    *
    * - Processing:
    * totalamount is multiplied by 100 to convert to cents.
    * Value is then divided by 1000 to find amount of ten dollar bills in amount.
    * The remainder of operation is then divided by 500 to find amount of five dollar bills in amount.
    * The remainder of operation is then divided by 100 to find amount of one dollar bills in amount.
    * The remainder of operation is then divided by 25 to find amount of quarters in amount.
    * The remainder of operation is then divided by 10 to find amount of dimes in amount.
    * The remainder of operation is then divided by 5 to find amount of knickels in amount.
    *
    *
    *
    * - Outputs:
    * Display amount of ten dollar bills in totalamount.
    * Display amount of five dollar bills in totalamount.
    * Display amount of dollar bills in totalamount.
    * Display amount of quarters in totalamount.
    * Display amount of dimes in totalamount.
    * Display amount of pennies in totalamount.
    *
    * @author Robert Gonzalez
    * @version 1.1
    *

Similar Threads

  1. Help merging program code with GUI code
    By Wilha in forum AWT / Java Swing
    Replies: 2
    Last Post: January 25th, 2012, 07:03 PM
  2. 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
  3. Code is giving an error in console, but there are no errors apparent in the code!
    By JamEngulfer221 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 15th, 2011, 09:30 PM
  4. describe this program code by code ....
    By izzahmed in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 29th, 2011, 11:03 PM