QuestionQuestion

You are implementing a brand new type of ATM that provides exact amounts of cash (bills only, no coins). In order to maximize potential revenue an algorithm is needed that will allow for using different 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 line will be a space separated list of the bill denomination sizes.
3. The program shall then read each line in the rest of the file containing an integer and output the number of different ways to produce that value using the denominations listed in the first line.
4. The program shall indicate after that the number the number of milliseconds the 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 each implementation.
7. The program shall write the output to a file in the same directory as the input file.
8. It should have Error handling, input checking.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
import javax.swing.JFileChooser;

/**
*
* @author
*/
public class ATM {

    public static void main(String[] args) {
       // The program shall graphically prompt the user for a file.
       JFileChooser fc = new JFileChooser();
       int result = fc.showOpenDialog(null);

       if (result != JFileChooser.APPROVE_OPTION) {
            System.exit(0);
       }
       File input = fc.getSelectedFile();

       try {
            run(input);

       } catch (Exception e) {
            System.out.println(e.getMessage());
       }
    }

    private static void run(File file) throws FileNotFoundException {
       int number;
       long start, recursiveTime, dpTime;
       int recursiveCounter...

By purchasing this solution you'll be able to access the following files:
ATM.java and input.txt.

$56.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Computer Science - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats