Объектно-ориентированное программирование

int seconds=d.get(Calendar.SECOND);

String S111=""+year;

String S122=""+mouth;

String S133=""+day;

String S144=""+hour;

String S155=""+minute;

String S166=""+seconds;

FileOutputStream OS2=new FileOutputStream (new File("C:\\USER\\Time.txt"));

DataOutputStream ods2 = new DataOutputStream (OS2);

ods2.writeUTF(S111);

ods2.writeUTF(S122);

ods2.writeUTF(S133);

ods2.writeUTF(S144);

ods2.writeUTF(S155);

ods2.writeUTF(S166);

ods2.close();

if(t1==2)

{

FileOutputStream OS6=new FileOutputStream (new File("C:\\USER\\teacher.txt"));

DataOutputStream ods6 = new DataOutputStream (OS6);

ods6.writeUTF("1");

ods6.close();

}

else

{

FileOutputStream OS6=new FileOutputStream (new File("C:\\USER\\teacher.txt"));

DataOutputStream ods6 = new DataOutputStream (OS6);

ods6.writeUTF("0");

ods6.close();

}

ButtonFrame frame = new ButtonFrame ();

frame.setVisible(true);

}

}

}

}

else

{

System.out.print("You full!");

}

}

catch (IOException e)

{

System.out.print("Can not read file77777"+e);

}

}

if(ccc==3)

{

try{

t++;

S13 = login.getText();

System.out.println(S13);

pass = Password.getPassword();

System.out.println(pass);

S14=new String(pass,0,6);

File file = new File("C:\\RGR\\"+S13+".txt");

File file1 = new File("C:\\KURS\\"+S13+".txt");

File file2 = new File("C:\\Student\\"+S13+".txt");

File file3 = new File("C:\\Student1\\"+S13+".txt");

try

{

file.createNewFile();

file1.createNewFile();

file2.createNewFile();

file3.createNewFile();

}

catch(IOException e)

{

System.out.println("Can not create new file"+e);

}

FileOutputStream OS=new FileOutputStream (new File("C:\\RGR\\"+S13+".txt"));

DataOutputStream ods = new DataOutputStream (OS);

ods.writeUTF(S13);

ods.writeUTF(S14);

ods.close();

FileOutputStream OS1=new FileOutputStream (new File("C:\\KURS\\"+S13+".txt"));

DataOutputStream ods1 = new DataOutputStream (OS1);

ods1.writeUTF(S1);

ods1.writeUTF(S2);

ods1.writeUTF(S3);

ods1.writeUTF(S4);

ods1.writeUTF(S5);

ods1.writeUTF(S6);

ods1.writeUTF(S7);

ods1.writeUTF(S8);

ods1.writeUTF(S9);

ods1.writeUTF(S10);

ods1.close();

}

catch(IOException e)

{

System.out.println("Can not write file"+e);

}

}

}

private int ccc;

private char[] pass = new char[20];

private String S13;

private String S14;

private boolean dd;

private int t;

private int t1=0;

private String r="111111";

private String S1;

private String S2;

private String S3;

private String S4;

private String S5;

private String S6;

private String S7;

private String S8;

private String S9;

private String S10;

private String S11="lector";

}

private JPasswordField Password;

private JTextField login;

private JLabel label1;

private JLabel label2;

}

class CheckBoxFrame extends JFrame

{

public CheckBoxFrame()

{

setTitle("Test");

setSize(600,200);

Container contentPane = getContentPane ();

JPanel panel = new JPanel ();

label = new JLabel ("Внимания, вы проходите тестирование - не дурачится и внимательно вчитывайтесь в вопрос!");

contentPane.add(label,BorderLayout.NORTH);

replace1=new JButton("Finish");

replace = new JButton("Next");

panel.add(replace);

panel.add(replace1);

contentPane.add(panel,BorderLayout.SOUTH);

try

{

FileInputStream is45 = new

FileInputStream(new

File("C:\\USER\\NOW.txt"));

DataInputStream ids45 = new DataInputStream(is45);

S2=ids45.readUTF();

FileInputStream is = new

FileInputStream(new

File("C:\\USER\\Control.txt"));

ids = new DataInputStream(is);

}

catch(IOException e)

{

System.out.print("Can not read file888888"+e);

}

replace1.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent event2)

{

label.setText("Ваш результат - "+fff*10+"% угаданых вопросов от общего количества вопросов");

}

});

replace.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent event2)

{

w=0;

c=0;

try

{

if(y<10)

{

S3=ids.readUTF();

label.setText("<html>Внимания, вы проходите тестирование - не дурачится и внимательно вчитывайтесь в вопрос!<br>"+S3);

}

}

catch(IOException e)

{

System.out.print("Can not read file5555"+e);

}

}

});

buttonPanel = new JPanel();

group = new ButtonGroup ();

addRadioButton("Дa",3);

addRadioButton("Частично",1);

addRadioButton("Нет",2);

addRadioButton("Другой ответ",0);

contentPane.add(buttonPanel,BorderLayout.CENTER);

try

{

FileInputStream is4 = new

FileInputStream(new

File("C:\\USER\\Answers.txt"));

ids4 = new DataInputStream(is4);

}

catch(IOException e)

{

System.out.print("Can not read file4444"+e);

}

}

public void addRadioButton(String name, final int size)

{

boolean selected = size==mode;

JRadioButton button = new JRadioButton(name,selected);

group.add(button);

buttonPanel.add(button);

try{

OS=new FileOutputStream (new File("C:\\Student1\\"+S2+".txt"));

ods = new DataOutputStream (OS);

}

catch (IOException e)

{

System.out.print("Can not read file3333"+e);

}

ActionListener listerner = new ActionListener()

{

public void actionPerformed(ActionEvent event1)

{

if(c==0)

{

if(y<10)

{

w++;

if(w==1)

{

try

{

String S31=ids4.readUTF();

r=Integer.parseInt(S31);

}

catch(IOException e)

{

System.out.print("Can not read file2222"+e);

}

if(r==size)

{

fff++;

try{

String X=""+y;

ods.writeUTF(X);

OS1=new FileOutputStream (new File("C:\\Student\\"+S2+".txt"));

ods1 = new DataOutputStream (OS1);

S3=""+fff;

ods1.writeUTF(S3);

}

catch (IOException e)

{

System.out.print("Can not read file111"+e);

}

}

}

}

}

y++;

}

};

button.addActionListener(listerner);

}

private JLabel label;

private JPanel buttonPanel;

private ButtonGroup group;

private static final int mode=0;

Страница:  1  2  3  4  5  6  7 


Другие рефераты на тему «Программирование, компьютеры и кибернетика»:

Поиск рефератов

Последние рефераты раздела

Copyright © 2010-2024 - www.refsru.com - рефераты, курсовые и дипломные работы