src/main/java/com/zopa/main/App.java
/**
     * @param args supplied file path and loan amount
     * @throws IOException and InvalidRequestAmountException
     */
@param args supplied file path and loan amount
@throws IOException and InvalidRequestAmountException
@param args supplied file path and loan amount @throws IOException and InvalidRequestAmountException
public static void main(String[] args) throws IOException, InvalidRequestAmountException {
        if (args.length < 2 || !validationService.isNumeric(args[1])) {
            System.err.println("Incomplete/invalid parameters supplied");
            System.exit(1);
        }
        try {
            Loan loan = new Loan(args[1]);
            validationService.validateLoan(loan);
            offerService = new CreditOfferService(args[0]);
            List<Offer> offers = offerService.getLoanOffers(loan);
            calculationService = new QuoteCalculationService(loan, offers);
            System.out.println("Request Amount: £" + String.format("%.0f", loan.getRequestedAmount()));
            System.out.println("Rate: " + String.format("%.1f", calculationService.getAverageRate() * 100) + "%");
            System.out.println("Monthly repayment £" + String.format("%.2f", calculationService.getMonthlyPayment()));
            System.out.println("Total repayment: £" + String.format("%.2f", calculationService.getTotalPayment()));
        } catch (InvalidRequestAmountException e) {
            System.out.println(e.getMessage());
        } catch (InsufficientOfferException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
public static void main ( String [ ] args ) throws IOException , InvalidRequestAmountException { if ( args . length < 2 || ! validationService . isNumeric ( args [ 1 ] ) ) { System . err . println ( "Incomplete/invalid parameters supplied" ) ; System . exit ( 1 ) ; } try { Loan loan = new Loan ( args [ 1 ] ) ; validationService . validateLoan ( loan ) ; offerService = new CreditOfferService ( args [ 0 ] ) ; List < Offer > offers = offerService . getLoanOffers ( loan ) ; calculationService = new QuoteCalculationService ( loan , offers ) ; System . out . println ( "Request Amount: £"  tring. f ormat( " %.0f", oan. g etRequestedAmount( ) ) ) ; System . out . println ( "Rate: " + String . format ( "%.1f" , calculationService . getAverageRate ( ) * 100 ) + "%" ) ; System . out . println ( "Monthly repayment £"  tring. f ormat( " %.2f", alculationService. g etMonthlyPayment( ) ) ) ; System . out . println ( "Total repayment: £"  tring. f ormat( " %.2f", alculationService. g etTotalPayment( ) ) ) ; } catch ( InvalidRequestAmountException e ) { System . out . println ( e . getMessage ( ) ) ; } catch ( InsufficientOfferException e ) { System . out . println ( e . getMessage ( ) ) ; } System . exit ( 0 ) ; }
@param args supplied file path and loan amount
 @throws IOException and InvalidRequestAmountException
@param args supplied file path and loan amount @throws IOException and InvalidRequestAmountException
// First call is to validate // Create and initialize the offer service // Offers should only be obtained if request is valid // Create and initialize the calculation service // print the result