Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int numb() {
- boolean invalidinput = false;
- int n = 0;
- do {
- boolean iscorrect = false;
- try {
- BufferedReader input = new BufferedReader(new FileReader("D:\\input.txt"));
- String text = input.readLine();
- do {
- System.out.print("Enter the number of sequence members ");
- n = Integer.parseInt(text);
- System.out.println(n);
- iscorrect = enter(n, 10, 1);
- } while (iscorrect);
- } catch (FileNotFoundException e) {
- System.out.println("A file with the same name was not found");
- invalidinput = true;
- } catch (IOException e) {
- System.out.println("This file cannot be opened");
- invalidinput = true;
- } catch (NumberFormatException e) {
- System.out.println("Error! File contains invalid data");
- invalidinput = true;
- }
- } while (invalidinput);
- return n;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement