# How can I make some questions worth more points?

I did a questionnaire with this script and wanted to make some questions worth more points, can someone help me?

``````public Text question;

public string[] Questions;
public string[] alternativeA;
public string[] alternativeB;
public string[] corrects;

private int idQuestion;

private float correct;
private float questions;
private float average;

// Use this for initialization
void Start ()
{

idQuestion = 0;
questions = Questions.Length;

question.text = Questions[idQuestion];

infoAnswer.text = "Respondendo " + (idQuestion + 1) + " de " + questions.ToString() + " perguntas.";

}

{
if(alternative == "A")
{
if (alternativeA[idQuestion] == corrects[idQuestion])
{
correct += 1;

}
}
else if(alternative == "B")
{
if (alternativeB[idQuestion] == corrects[idQuestion])
{
correct += 1;

}
}

nexQuestion();

}

void nexQuestion()
{
idQuestion += 1;

if(idQuestion <= (questions - 1))
{
question.text = Questions[idQuestion];

infoAnswer.text = "Respondendo " + (idQuestion + 1) + " de " + questions.ToString() + " perguntas.";
``````

}
else
{
//nota
average = 10 * (correct / questions); //media
finalGrade = Mathf.RoundToInt(average); //arredonda a media

``````	if(finalGrade > PlayerPrefs.GetInt("finalGrade"))
``````

{
PlayerPrefs.SetInt(“corrects”, (int) correct);

}
PlayerPrefs.SetInt(“correctsTemp”, (int) correct);

``````	Application.LoadLevel("evaluation");
}
}
``````

}

You could follow the same pattern as you are and have

``````public int[] questionValue;
``````

which you could then use on lines 40 and 49 as:

``````correct += questionValue[idQuestion];
``````

However you might notice that things are getting complicated with so many arrays that all have to be kept in sync. One of the nice things about object oriented programing is that you can encapsulate all these linked pieces of information together in a new class:

``````public class Question {

private string correctOption;

private int points;

this.correctOption = correctOption;
this.points = points;
}

public string getAlternativeA(){
}

public string getAlternativeB(){
}

public int scoreOf(string option){
if(option == correctOption){
return points;
}else{
return 0;
}
}

}
``````

This makes it super easy to have all the information you need synchronised up for you and in one place!