Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MyVector<Yacht> vec;
- vec = new MyVector<Yacht>();
- MyVector<SallingYacht> sv = new MyVector<>();
- averageCostOfYacht(sv);
- System.out.println("Если хотите выбрать ввод данных с клавиатуры нажмите 1, если сгенерировать случайно, то 2:");
- Scanner sc = new Scanner(System.in);
- int typeOfInterface = sc.nextInt();
- System.out.println("Если хотите загрузить сохраненые данные из файла нажмите 1, иначе 2:");
- int actionType = sc.nextInt();
- if (actionType == 1) {
- ObjectInputStream ins = null;
- try {
- ins = new ObjectInputStream(new FileInputStream("D:\\University\\5_course\\Java\\Container.dat"));
- Object tmp = ins.readObject();
- if (tmp.getClass() == vec.getClass())
- vec = (MyVector<Yacht>)tmp;
- } catch (FileNotFoundException e) {
- System.out.println(e);
- } finally {
- System.out.println("Sucessfully load.");
- ins.close();
- }
- }
- if (typeOfInterface == 1) {
- KeyboardDialog ob = new KeyboardDialog();
- while (true) {
- ob.inputInformation(typeOfInterface, vec);
- ob.inputFromKeyboard(vec);
- if (ob.actionType == 4)
- break;
- }
- } else if (typeOfInterface == 2) {
- RandomDialog ob = new RandomDialog();
- while (true) {
- ob.inputInformation(typeOfInterface, vec);
- ob.inputRandomData(vec);
- if (ob.actionType == 4)
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment