Ejemplo n.º 1
0
  /** The admin can see a report of a given month and year. */
  private void seeReport() {
    int m, a;
    boolean check = false;
    m = 0;
    a = 0;

    // Ask for a month until the number of the month is correct.
    while (!check) {
      Consola.escriu("Insert the number of the month you would like to see");
      m = Consola.llegeixInt();
      if ((0 < m) && (m < 13)) {
        check = true;
      } else {
        Consola.escriu("Your number is incorrect. Please, try it again");
      }
    }

    check = false;
    // Ask for a year until the number of the year is correct.
    while (!check) {
      Consola.escriu("Insert the number of the year you would like to check");
      a = Consola.llegeixInt();

      // This can be changed. If the application is running for years, then
      // sure some years past 2017 would be correct years too.
      if (0 < a && 2017 >= a) {
        check = true;
      } else {
        Consola.escriu("Your number is incorrect. Please, try it again");
      }
    }
    Consola.escriu("");
    Consola.escriu("**MONTHLY REPORT**");
    Consola.escriu("");
    for (Client c : lstClient) {
      c.printDNI();
      Consola.escriu("Reserves done by this client: ");
      c.printReservesByMonthYear(m, a);
      Consola.escriu("-----------------------");
    }
  }