My first program = Quiz :D



Alright, here is my first program. Just testing it.

----------------------------------------
import java.util.Scanner;
public class quiz {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner myScanner = new Scanner(System.in);

String thisString;
double points = 0;
double total;

System.out.println("Did Germany win vs. Portugal? Yes or no");
thisString = myScanner.nextLine();

if (thisString.equals("Yes")) {
System.out.println("That is correct! Plus points!");
total = points + 1;
System.out.println("Is the Galaxy Tab android?");
thisString = myScanner.nextLine();
if (thisString.equals("Yes")) {
System.out.println("That is correct. Plus points!");
total = points + 1;
}
}
}
}
---------------------------------------------------------
Now, my question is -
I wrote the statement(total = points + 1;)twice. Even though I answered "yes
(the correct answer to each question)twice my total points came to 1. Should they not add up and become two? Thank-you for the answers.
.



Relevant Pages