NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.yogi.multiplechoice;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
TextView pertanyaan;
Button tombolnext;
RadioGroup radioGroup;
RadioButton pilihanA,pilihanB,pilihanC,pilihanD;
int nomor; public static int hasil,benar,salah;
String[] pertanyaan_user=new String[]{
"1. Ibukota Negara Kesatuan Republik Indonesia adalah ?",
"2. Presiden Pertama Negara Indonesia adalah",
"3. Lagu Kebangsaan Republik INdonesia adalah",
"4. Lambang Negara Kesatuan Republik Indonesia adalah",
"5. Bendera Negara Kesatuan Republik Indoesia adalah" };
String[] jawaban=new String[]{
"Medan","Jakarta","Bandung","Surabaya",
"Suharto","M.Yamin","Sukarno","Jokowi", "Maju Takgentar","Indonesia Merdeka",
"Indonesia Raya","Himne guru", "Burung ELang","Burung Nuri","Burung Kakatua",
"Burung Garuda", "Merah kuning","Merah Putih","Merah Jambu","Merah biru" };
String[] jawaban_Benar=new String[]{
"Jakarta", "Sukarno", "Indonesia Raya", "Burung Garuda", "Merah Putih" };

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); pertanyaan=(TextView)findViewById(R.id.pertanyaan);
radioGroup=(RadioGroup)findViewById(R.id.radiogrup); pilihanA=(RadioButton)findViewById(R.id.pilihanA);
pilihanB=(RadioButton)findViewById(R.id.pilihanB); pilihanC=(RadioButton)findViewById(R.id.pilihanC);
pilihanD=(RadioButton)findViewById(R.id.pilihanD); pertanyaan.setText(pertanyaan_user[0]);
pilihanA.setText(jawaban[0]); pilihanB.setText(jawaban[1]); pilihanC.setText(jawaban[2]);
pilihanD.setText(jawaban[3]); radioGroup.check(0); benar=0; salah=0; nomor=0; }

public void lanjut(View view){ if
(pilihanA.isChecked()||pilihanB.isChecked()||pilihanC.isChecked()||pilihanD.isChecked()) {
//pilihan radio adalah pilihan sesuai dengan pilihan dalan radio group
RadioButton
jawaban_user=(RadioButton)findViewById(radioGroup.getCheckedRadioButtonId());
String ambiljawaban_user=jawaban_user.getText().toString(); radioGroup.check(0);
if (ambiljawaban_user.equalsIgnoreCase(jawaban_Benar[nomor])) benar++;
else salah++; nomor++;
if(nomor<pertanyaan_user.length)
{
pertanyaan.setText(pertanyaan_user[nomor]);
pilihanA.setText(jawaban[(nomor*4)+0]);
pilihanB.setText(jawaban[(nomor*4)+1]);
pilihanC.setText(jawaban[(nomor*4)+2]);
pilihanD.setText(jawaban[(nomor*4)+3]);
}else { hasil=benar*20;
Intent nilaisoal=new
Intent(getApplicationContext(),HasilSoal.class);
startActivity(nilaisoal);
}
}else {
Toast.makeText(getApplicationContext(),"Pilih Jawaban terlebih dahulu !",Toast.LENGTH_LONG).show();
}
}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.