/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package vacationprice;
/**
*
* @author j
*/
import java.io.IOException;
import javax.swing.*;
import java.util.Scanner;
class daysAvailable {
public static String getMessage (int daySearched) {
// create array for number of days available
int[] a={1,4,6,8,9, 12,13,14,18,22,24,25,28,30};
String s = "";
for(int i=0;i<a.length;i++){
// if one of the values in the array is the day the user searches for, the day of the array is available
if(a[i]==daySearched){
s = ("Day "+daySearched+"is available");
break;
}
else if(a[i]!=daySearched)
{
// if not, the day is not available
s = ("This day of the month is not available");
break;
}
}
return s;
}
}
Comments