Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- public class TestClass {
- public static void readFile(File file) throws IOException {
- BufferedReader br = new BufferedReader(new FileReader(file));
- String line;
- while ((line = br.readLine()) != null)
- System.out.println(line);
- }
- public static void main(String[] args) throws IOException {
- // VERIFY CLASSES TEST
- VerifyDate x = new VerifyDate();
- x.verify("12/12/2018");
- VerifyPhoneNumber y = new VerifyPhoneNumber();
- y.verify("886542164");
- // CATEGORIES TEST
- File file;
- Scanner scan= new Scanner(System.in);
- // Test the categories by typing "Yes"
- System.out.println("Do you want to see categories of offenses? Press 'Yes' to see.");
- String checkAttachements = scan.nextLine();
- System.out.println(checkAttachements);
- if(checkAttachements=="Yes") {
- do {
- // Test the categories by choosing attachement
- System.out.println("Choose attachement 1-5 (Type 1,2,3,4 or 5) to see categories in it");
- int attachement = scan.nextInt();
- switch(attachement) {
- case 1:
- file = new File("zalacznik1.txt");
- readFile(file);
- break;
- case 2:
- file = new File("zalacznik2.txt");
- readFile(file);
- break;
- case 3:
- file = new File("zalacznik3.txt");
- readFile(file);
- break;
- case 4:
- file = new File("zalacznik4.txt");
- readFile(file);
- break;
- case 5:
- file = new File("zalacznik5.txt");
- readFile(file);
- break;
- default:
- System.out.println("Unknown attachement");
- break;
- }
- System.out.println("Stop or again? Press Exit if you want to stop or No if not");
- checkAttachements = scan.nextLine();
- } while(checkAttachements!="Exit");
- }
- }
- }
Add Comment
Please, Sign In to add comment