| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Java Exercises - Selection

Page history last edited by Steve Sweeney 14 years, 1 month ago
  1. In the country of Rahmania, the cost of mailing a letter is 40 sinas for letters up to 30g, 55 sinas for letters over 30g and up to 50g, 70 sinas for letters over 50g and up to 100g, and then an additional 25 sinas for each additional 50g or part thereof.  Write a program tha prompts the user for a mass and then gives the cost of mailing a letter having that mass.

     

  2. Write a program that makes change for amounts less than one dollar.  Input to the program should be a positive integer less than 100, representing an amount of money, in cents.  Output should be the original amount of money together with a set of coins (quarters, dimes, nickels, pennies) that could make up that amount.

    Improvements:

    1. The program should produce change containing the minimum number of coins required.
    2. The output should be expressed in a natural form.  For example, don't refer to zero coins of a particular type, or the singular or plural forms for coins should be used correctly (i.e., "1 dime", not "1 dimes").

       

  3.  

Comments (0)

You don't have permission to comment on this page.