Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void summaryPolicy()
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Show summary of policy.txt or archive.txt? Enter policy or archive");
- String selection = input.next();
- selection.toLowerCase();
- while(!"policy".equals(selection) && !"archive".equals(selection))
- {
- System.out.println("Please enter policy or archive");
- selection = input.next();
- selection.toLowerCase();
- }
- if("policy".equals(selection))
- {
- try
- {
- FileReader file = new FileReader("policy.txt");
- BufferedReader buffer = new BufferedReader(file);
- String s = "";
- while((s = buffer.readLine()) != null)
- {
- System.out.println(s);
- System.out.println("Total number of policies: " + getRowCountPolicy());
- }
- buffer.close();
- }
- catch(IOException error)
- {
- System.out.println("File could not be read");
- }
- }
- else if("archive".equals(selection))
- {
- try
- {
- FileReader file = new FileReader("archive.txt");
- BufferedReader buffer = new BufferedReader(file);
- String s = "";
- while((s = buffer.readLine()) != null)
- {
- System.out.println(s);
- }
- System.out.println("Total number of policies: " + getRowCountArchive());
- buffer.close();
- }
- catch(IOException error)
- {
- System.out.println("File could not be read");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement