• Make sure to read the forum rules before creating a new thread or commenting on someone else's thread. The forum rules can be read on this page.
CavalryRebellion
Reaction score
0

Profile posts Postings About

  • The glory days of knocking people off the cliff with a horse. I wish I can do that to my AP exams coming next week.
    G
    Gilgarach
    hi boxer
    Magikkarp
    Magikkarp
    I'm with ya on that one
    G
    be online more
    CavalryRebellion
    CavalryRebellion
    Fuck you. Mr. Lau, my hardcore Asian teacher, has no interest in my video games. It is all about that cup of Java.
    G
    Guest
    I feel hurt. :(
    CavalryRebellion
    import java.util.Scanner;
    public class AdvancedDispenser
    {
    public static void main(String args)
    {
    Scanner console = new Scanner (System.in);
    System.out.print("Enter price of item (in cents): ");
    int price = console.nextInt();
    int change = 100 - price;

    int quarter = 25, dime = 10, nickel = 5, penny = 1;
    int numberofquarters = change / quarter;
    int leftover = change - numberofquarters * quarter;
    int numberofdimes = leftover / dime;
    int leftover2 = leftover - numberofdimes * dime;
    int numberofnickels = leftover2 / nickel;
    int leftover3 = leftover2 - numberofnickels * nickel;
    int numberofpennies = leftover3 / penny;

    System.out.println(" ");
    String conclusion = "You bought an item for " + price;
    String conclusion2 = " cents and gave me a dollar,";
    String conclusion3 = "so your change is:";
    System.out.print(conclusion);
    System.out.println(conclusion2);
    System.out.println(conclusion3);
    System.out.println(" ");
    System.out.println(numberofquarters + " quarter(s),");
    System.out.println(numberofdimes + " dime(s),");
    System.out.println(numberofnickels + " nickel(s),");
    System.out.print(numberofpennies + " penny(ies)");
    } //End of main
    } //End of AdvancedDispenser

    It is wrong to spam in mineplex, but Java doesn't give a fuck.
  • Loading…
  • Loading…
Back
Top