samedi 28 février 2015

How to create a for statement to handle my Exception



I had previously created a program that contained a customerList that added courses to each customer via their courseList. Now I have to modify the program (having a new list of customers) to throw an exception called CustomerNotEnrolledException if one the customers are not enrolled in any course.


I throw the exception from a createInvoice method in my Customer class, and handle it in the test class. My question is:


How will I write a for loop to check for these courses within each customer.


The two arrays that I have declared earlier are:



ArrayList<Course> courseList = new ArrayList<Course>();
ArrayList<Customer> customerList = new ArrayList<Customer>();



Aucun commentaire:

Enregistrer un commentaire