Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[HELP] Sa programming ko. JAVA

VirusExcelL

Proficient
Advanced Member
Messages
221
Reaction score
1
Points
28
Good day po sainyo.
Need ko po ng code na mag bibigay ng score kada question at may over all total ng Quiz bee ko. Ngayon lang kasi sinabi sakin ng ka classe ko.
Na stress na aq. gumawa pa aq ng PA PD at Algo.. more than 40 item po nagawa ko. 2 item lang ipopost ko dito.
anyway, hope ma bigyan nyo po ako ng code kasi bukas na kasi yung defense namin eh..

import java.util.*;
public class Defence {

public static void main(String[] args) {



String[] Multiplechoice1;
Scanner input = new Scanner(System.in);
System.out.println ("PhilGOV\n");
Multiplechoice1 = new String[6];
Multiplechoice1[0] = "1.Who is the Philippine Natonal Hero?\n";
Multiplechoice1[1] = "A:Jose Rizal";
Multiplechoice1[2] = "B.Lapu,Lapu";
Multiplechoice1[3] = "C.Apolinario Mabini";
Multiplechoice1[4] = "D.Engeng";

String userSelect1 = Multiplechoice1[0];

if(userSelect1==Multiplechoice1[0]){
System.out.println (Multiplechoice1[0]);
System.out.println ("A.Jose Rizal");
System.out.println ("B.Lapu,Lapu");
System.out.println ("C.Apolinario Mabini");
System.out.println ("D.Engeng");
System.out.print ("Your Answer: ");

userSelect1 = input.next();

switch (userSelect1.toUpperCase()){
case "A":
userSelect1 = "Jose Rizal";
System.out.println ("Correct!\n\n");
break;

case "B":
userSelect1 = "Lapu,Lapu";
System.out.println ("Icorrect!\n\n");
break;

case "C":
userSelect1 = "Apolinario Mabini";
System.out.println ("Incorrect!\n\n");
break;

case "D":
userSelect1 = "Engeng";
System.out.println ("Incorrect!\n\n");

default:
userSelect1 = "incorrect, choice.\n\n";
System.out.println ("Incorrect, choice.\n\n");
break;
}

}
String[] Multiplechoice2;


Multiplechoice2 = new String[5];
Multiplechoice2[0] = "2.Who is the first president?\n\n";
Multiplechoice2[1] = "A.Juan Luna";
Multiplechoice2[2] = "B.Emlio Aguinaldo";
Multiplechoice2[3] = "C.George W. Bush";
Multiplechoice2[4] = "Ferdinand Marcos";

String userSelect2 = Multiplechoice2[0];

if(userSelect2==Multiplechoice2[0]){
System.out.println (Multiplechoice2[0]);
System.out.println ("A.Juan Luna");
System.out.println ("B.Emilio Aguinaldo");
System.out.println ("C.George W. Bush");
System.out.println ("D.Ferdinand Marcos");
System.out.println ();
System.out.print ("Your Answer: ");

userSelect2 = input.next();

switch (userSelect2.toUpperCase()){
case "A":
userSelect2 = "A.Juan Luna";
System.out.println ("Incorrect!\n\n");
break;

case "B":
userSelect2 = "B.Emilio Aguinaldo";
System.out.println ("Correct!\n\n");
break;

case "C":
userSelect2 = "C.George W. Bush";
System.out.println ("Incorrect!\n\n");
break;

case "D":
userSelect2 = "D.Ferdinand Marcos";
System.out.println ("Incorrect!\n\n");
break;

default:
userSelect2 = "incorrect, choice.\n\n";
System.out.println ("Incorrect, choice.\n\n");
break;
}
}
}
}
 
Last edited:
I'm not a java programmer, so bear with me.

1. Gawa ka ng variable para sa total score mo. (eg. totalScore)
2. Since yung mga questions / answer / choices mo ay nasa array, isama mo na din sana yung equivalent points mo dun.
3. Dun sa case ng "correct answer", maglagay ka ng:
totalScore = totalScore + Multiplechoice1[9]; // array index for score, see #2


Iyan na lang ang magagawa mo remedyo sa current na gawa mo. Napakadami kailangang baguhin dahil sa array mo lang nilalagay ang mga questions / answer / choices mo. Kung yan ay inilagay mo sa database, hindi ka nahirapan. Also, "classic" student, kung kailan kinabukasan na kailangan, tsaka pa lang gagawa. Huwag mo na isisi sa groupmate mo, you yourself should know the status of your project. :)
 
I'm not a java programmer, so bear with me.

1. Gawa ka ng variable para sa total score mo. (eg. totalScore)
2. Since yung mga questions / answer / choices mo ay nasa array, isama mo na din sana yung equivalent points mo dun.
3. Dun sa case ng "correct answer", maglagay ka ng:



Iyan na lang ang magagawa mo remedyo sa current na gawa mo. Napakadami kailangang baguhin dahil sa array mo lang nilalagay ang mga questions / answer / choices mo. Kung yan ay inilagay mo sa database, hindi ka nahirapan. Also, "classic" student, kung kailan kinabukasan na kailangan, tsaka pa lang gagawa. Huwag mo na isisi sa groupmate mo, you yourself should know the status of your project. :)
natawa nga ako sabay galit sakanya. Nag tanong ako ano mga sinabi ni Sir at kung ano raw ipagawa. Sinabi nya sakin lahat. (Absent ako that day dahil sa LBM)
then kahapon bigla nya ni bring up yung total score? (Sabi ko sa isip ko WUT?)
then sabi ko sakanya. sabay lang tayo nag cocode tapos di mo sinabi yan? ayun bigla aq na stress kasi baka mag babago nanaman ako ng code. sabay templa ng kape sakanya at nag kwentuhan nalang kung ano na gagawin namin bukas. Buti nalang Suspended yung class dito samin. May chance pa. :D

anyway, salamat sa advice mo sir. :)
Hope maka abot pa to bukas.
 
Last edited:
Back
Top Bottom