You are implementing a brand new type of ATM that provides exact amounts of cash (bills...

90.2K

Verified Solution

Question

Programming

You are implementing a brand new type of ATM that provides exactamounts of cash (bills only, no coins). In order to maximizepotential revenue an algorithm is needed that will allow for usingdifferent denomination amounts as needed by the local currency(value of bills will vary, but are integers).

  1. The program shall graphically prompt the user for a file.

  2. The program shall read the selected file of which the first linewill be a space separated list of the

    bill denomination sizes.

  3. The program shall then read each line in the rest of the filecontaining an integer and output the

    number of different ways to produce that value using thedenominations listed in the first line.

  4. The program shall indicate after that the number of millisecondsthe program spent calculating

    the answer.

  5. The program shall implement 2 different forms of the algorithm:1 recursive and 1 using dynamic

    programming.

  6. The program shall have 2 sets of output, 1 for eachimplementation.

  7. The program shall write the output to a file in the samedirectory as the input file.

  8. The program must be written in Java.

Answer & Explanation Solved by verified expert
3.6 Ratings (598 Votes)
import javaio import javautil class Main public static int calculatedpbottomupapproachint denominations int amount Dynamic programming approach int dp new intamount 1 dp0 1 for int i 0 i denominationslength i for int j denominationsi j 1 return 0 return calculaterecursivedenominations index 1 amount calculaterecursivedenominations index amount denominationsindex public static void mainStringargs throws Exception SystemoutprintlnPlease enter file path Scanner input new ScannerSystemin String path inputnext File file new Filepath while fileexists    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students