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

Thread: No error, but I want criticism

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb No error, but I want criticism

    Please take a look at my application, either execute the class from console, or run .bat on windows.

    Virus Scan:
    virusscan.jpg

    Download

    Code:
    import static java.lang.System.out;
    import java.util.Scanner;
     
    class ChangeMaker {
     
    	public static void main(String args[]) {
    		Scanner inputNumber = new Scanner(System.in);
    		out.println("Enter amount of cents as a whole number:");
     
    		int total = inputNumber.nextInt();
     
    		int quarters = total / 25;
    		int extra = total % 25;
     
    		int dimes = extra / 10;
    		extra = extra % 10;
     
    		int nickels = extra / 5;
    		extra = extra % 5;
     
    		int pennies = extra;
     
    		out.println("From " + total + " cents, you get:");
            out.println(quarters + " quarters");
    		out.println(dimes + " dimes");
    		out.println(nickels + " nickels");
    		out.println(pennies + " pennies");
    	}
    }
    Last edited by JustForLawls; July 6th, 2011 at 01:22 PM. Reason: added source code


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: No error, but I want criticism

    Posting links makes it hard for someone to find your code with a Search.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: No error, but I want criticism

    No offense, but very few folks (myself included) will download and run an app when we have no idea what it does or what the code behind it contains. What exact feedback are you looking for? User interface layout? how it operates? Suggestions for developments?

  4. #4
    Junior Member
    Join Date
    Jul 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: No error, but I want criticism

    well, I'm not sure where to go next with it. You enter an int for amount of cents(I'm from USA), and it will tell you what coins make that amount. So, for $14.62, you would input 1462, and it will say how many quarters, dimes, nickels, and pennies make it up. Once I develop it more, I plan on having a free and paid version for restaurants and stores.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: No error, but I want criticism

    One change to the print out, don't print out 0 of a coin, just print when there are coins.

  6. #6
    Junior Member
    Join Date
    Jul 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: No error, but I want criticism

    oh okay, good idea.

  7. #7
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: No error, but I want criticism

    Quote Originally Posted by JustForLawls View Post
    Once I develop it more, I plan on having a free and paid version for restaurants and stores.
    Good luck with that

  8. #8
    Junior Member
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: No error, but I want criticism

    Quote Originally Posted by JustForLawls View Post
    well, I'm not sure where to go next with it. You enter an int for amount of cents(I'm from USA), and it will tell you what coins make that amount. So, for $14.62, you would input 1462, and it will say how many quarters, dimes, nickels, and pennies make it up. Once I develop it more, I plan on having a free and paid version for restaurants and stores.
    Sorry to burst your bubble but anybody can write a simple program to make change. I don't think any restaurant would pay for something like that. If you make a whole POS system for restaurants with dynamic input and networking... then you may be able too.