Esempio n. 1
0
  /**
   * event
   *
   * @throws RemoteException
   */
  private void buttonJawabActionPerformed() throws RemoteException {
    if (cekPilih()) {
      jawabanBs = new JawabanBs();
      jawabanBs.setMahasiswa(mhs);
      jawabanBs.setSoalBs(soalBsList.get(noSoal));
      jawabanBs.setJawab(Jawab.valueOf("S"));

      if (soalBsList.get(noSoal).getKunci() == KunciBs.valueOf(kunciJawaban())) {
        bener++;
        jawabanBs.setJawab(Jawab.valueOf("B"));
      }
      bsPretestService.save(jawabanBs);

      if (noSoal < jumlahSoal - 1) {
        noSoal++;
        textNo.setText((noSoal + 1) + "");
        textSoal.setText(soalBsList.get(noSoal).getSoal());
        buttonGroup.clearSelection();
      } else {
        nilai = ((double) bener / (double) jumlahSoal) * 100;
        nilaiBs = new NilaiBs();
        nilaiBs.setMahasiswa(mhs);
        nilaiBs.setPertemuanPraktikum(pertemuanPraktikum);
        nilaiBs.setNilai(nilai);
        nilaiBs.setStatusNilai(StatusNilai.Y);
        bsPretestService.save(nilaiBs);
        listener.selesai(nilai, setting.getBataLulus());
      }

    } else {
      JOptionPane.showMessageDialog(this, "jawaban tidak boleh kosong");
    }
  }
Esempio n. 2
0
  public void setPertemuanPraktikum(
      PertemuanPraktikum pertemuanPraktikum, Mahasiswa mhs, Setting setting)
      throws RemoteException {
    if (setting.getMenit() == 0) {
      h = setting.getJam() - 1;
      m = 59;
    } else {
      h = setting.getJam();
      m = setting.getMenit() - 1;
    }

    this.pertemuanPraktikum = pertemuanPraktikum;
    this.mhs = mhs;
    bsPretestService = MainFrameClient.getBsPretestService();
    this.setting = setting;
    soalBsList = bsPretestService.findSoalBss(pertemuanPraktikum);
    soalBsList = setRandomSoal(soalBsList);
    jumlahSoal = soalBsList.size();
    noSoal = 0;
    textNo.setText((noSoal + 1) + "");
    textSoal.setText(soalBsList.get(noSoal).getSoal());
    ActionListener al =
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent ae) {
            try {
              setDuration();
            } catch (RemoteException ex) {
              Logger.getLogger(PanelTestBs.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        };
    new Timer(1000, al).start();
  }
Esempio n. 3
0
 public void setDuration() throws RemoteException {
   // menghitung selisih waktu start dengan waktu sekarang
   if (s == 0) {
     s = 60;
     m--;
   } else {
     s--;
   }
   if (m == 0) {
     m = 60;
     h--;
   }
   Time t = new Time();
   TimeEntity te = t.timeFormat(s, m, h);
   labelWaktu.setText(te.getJam() + " : " + te.getMenit() + " : " + te.getDetik());
   if (h == -1) {
     h--;
     nilai = ((double) bener / (double) jumlahSoal) * 100;
     nilaiBs = new NilaiBs();
     nilaiBs.setMahasiswa(mhs);
     nilaiBs.setPertemuanPraktikum(pertemuanPraktikum);
     nilaiBs.setNilai(nilai);
     bsPretestService.save(nilaiBs);
     listener.selesai(nilai, setting.getBataLulus());
   }
 }