What continent is The United States of America located?

Previous assignment, assignmen is in the upload

import javax.swing.JOptionPane;

public class Quiz {

static String question ;

static int nQuestions = 0;

static int nCorrect = 0;

public static void main(String[] args) {

// TODO Auto-generated method stub

question = null;

question = “Which two NFL teams will play in Super Bowl 2022?n”;

question += “A. Rams and Bengalsn”;

question += “B. Packers and Commandersn”;

question += “C. Vikings and Eaglesn”;

question += “D. Raiders and Saintn”;

question += “E. Dolphins and Bearsn”;

check(question,”E”);

question = null;

question = “Which of the following should be used to compare the contents of two String objects in Java?n”;
question += “A. equalsn”;
question += “B. cmpn”;
question += “C. ==n”;
question += “D. =n”;
question += “E. ?n”;

check(question,”A”);
question = null;

question = “What continent is The United States of America located?n”;
question += “A. Asian”;
question += “B. North America and South American”;
question += “C. Anartican”;
question += “D. Oceanan”;
question += “E. all of the aboven”;

check(question,”B”);

JOptionPane.showMessageDialog(null,nCorrect+” correct out of “+nQuestions+”
questions.”);
}

static String ask(String question) {

String answer = JOptionPane.showInputDialog(question).toUpperCase();

while( !( answer.equals(“A”) || answer.equals(“B”) || answer.equals(“C”) ||

answer.equals(“D”) ||answer.equals(“E”)) ) {

JOptionPane.showMessageDialog( null,”Invalid answer. Please enter A, B, C, D,
or E.”);

ask(question);

}

return answer;

}

static void check(String question,String correctAnswer) {

nQuestions++;

String answer = ask(question);

if(answer.equals(correctAnswer)) {

JOptionPane.showMessageDialog(null,”Correct!”);

nCorrect++;

}else {

JOptionPane.showMessageDialog(null,”Incorrect.The correct answer is

“+correctAnswer+”.”);
}
}
}

Last Completed Projects

topic title academic level Writer delivered