The objective of this assignment is for you to review the university's policy on responsible use of its computing facilities and information technology resources and then write a program that asks a user to answer 5 multiple choice questions about the policy, grades their answers and returns their score.
First: Review the "Policy for Responsible Use" here.
Second: Write a Java program called ResponsibleUse that asks the user five (5) questions about the policy and scores their answers.
Your program should use the following constants, which hold the questions, their responses and their correct answers:
public static final String QUESTION_1 = "Which is NOT a purpose Millersville University makes electronic resources available to faculty, staff, and students?";
public static final String RESPONSE_1A = "For conducting official University business.";
public static final String RESPONSE_1B = "For academic scholarship.";
public static final String RESPONSE_1C = "For research.";
public static final String RESPONSE_1D = "For student access to social media sites.";
public static final String ANSWER_1 = "*"; // Replace with correct answer (a, b, c, or d)
public static final String QUESTION_2 = "Which usage is NOT described in the \"Policy for Responsible Use\"?";
public static final String RESPONSE_2A = "Electronic Mail";
public static final String RESPONSE_2B = "Network Use";
public static final String RESPONSE_2C = "Crypto-currency";
public static final String RESPONSE_2D = "User Accounts";
public static final String ANSWER_2 = "*"; // Replace with correct answer (a, b, c, or d)
public static final String QUESTION_3 = "Under which topic is improper printing of documents covered?";
public static final String RESPONSE_3A = "Electronic Mail";
public static final String RESPONSE_3B = "Network Use";
public static final String RESPONSE_3C = "Webpages";
public static final String RESPONSE_3D = "Software";
public static final String ANSWER_3 = "*"; // Replace with correct answer (a, b, c, or d)
public static final String QUESTION_4 = "The \"Privacy and Confidentiality of Electronic Media\" portion of the policy states that?";
public static final String RESPONSE_4A = "The University may be required to provide information stored in its system if so compelled by a court order.";
public static final String RESPONSE_4B = "Your privacy should be presumed at all times.";
public static final String RESPONSE_4C = "The University will routinely monitor and review the contents of your user accounts.";
public static final String RESPONSE_4D = "The University does not abide by recent court decisions regarding privacy and \"Right to Know.\"";
public static final String ANSWER_4 = "*"; // Replace with correct answer (a, b, c, or d)
public static final String QUESTION_5 = "Consequences of violating the policy includes?";
public static final String RESPONSE_5A = "Loss of access to University computing systems pending disciplinary process.";
public static final String RESPONSE_5B = "Possible prosecution under State laws or local laws.";
public static final String RESPONSE_5C = "Loss of access to University computing resources after the disciplinary process.";
public static final String RESPONSE_5D = "All of the above.";
public static final String ANSWER_5 = "*"; // Replace with correct answer (a, b, c, or d)
To further aid you in developing your program, the following example main method has been provided from the instructor's solution. Please use this method as-is:
public static void main(String[] args) {
int totalScore = 0;
Scanner console = new Scanner(System.in);
totalScore += askQuestion(console, 1, QUESTION_1, RESPONSE_1A, RESPONSE_1B, RESPONSE_1C, RESPONSE_1D, ANSWER_1);
totalScore += askQuestion(console, 2, QUESTION_2, RESPONSE_2A, RESPONSE_2B, RESPONSE_2C, RESPONSE_2D, ANSWER_2);
totalScore += askQuestion(console, 3, QUESTION_3, RESPONSE_3A, RESPONSE_3B, RESPONSE_3C, RESPONSE_3D, ANSWER_3);
totalScore += askQuestion(console, 4, QUESTION_4, RESPONSE_4A, RESPONSE_4B, RESPONSE_4C, RESPONSE_4D, ANSWER_4);
totalScore += askQuestion(console, 5, QUESTION_5, RESPONSE_5A, RESPONSE_5B, RESPONSE_5C, RESPONSE_5D, ANSWER_5);
printScore(totalScore);
}
Also, note that the main method calls two other methods: askQuestion and printScore. These are discussed in the NOTES section below.
NOTES:
/**
* Prompts the user with a supplied question along with supplied multiple choice responses,
* gets their response and if the response is correct given the supplied answer returns the
* appropriate points for that correct answer else 0 points are returned.
*
* @param console - For reading user input
* @param questionNum - integer value of the question number (e.g. 1, 2, 3).
* @param question - The question.
* @param respA - Response a.
* @param respB - Response b.
* @param respC - Response c.
* @param respD - Response d.
* @param answer - Correct answer to the question.
* @return
*/
public static int askQuestion(Scanner console, int questionNum, String question, String respA, String respB, String respC, String respD, String answer) {
// Your code goes here
}
/**
* Prints out the score for the user.
*
* @param totalScore
*/
public static void printScore(int totalScore) {
System.out.printf("\nYour score: %d%%\n", totalScore);
}
OUTPUT SPECIFICATION
Question #1: Which is NOT a purpose Millersville University makes electronic resources available to faculty, staff, and students?
a. For conducting official University business.
b. For academic scholarship.
c. For research.
d. For student access to social media sites.
Please enter a, b, c, or d: *
Question #2: Which usage is NOT described in the "Policy for Responsible Use"?
a. Electronic Mail
b. Network Use
c. Crypto-currency
d. User Accounts
Please enter a, b, c, or d: *
Question #3: Under which topic is improper printing of documents covered?
a. Electronic Mail
b. Network Use
c. Webpages
d. Software
Please enter a, b, c, or d: *
Question #4: The "Privacy and Confidentiality of Electronic Media" portion of the policy states that?
a. The University may be required to provide information stored in its system if so compelled by a court order.
b. Your privacy should be presumed at all times.
c. The University will routinely monitor and review the contents of your user accounts.
d. The University does not abide by recent court decisions regarding privacy and "Right to Know."
Please enter a, b, c, or d: *
Question #5: Consequences of violating the policy includes?
a. Loss of access to University computing systems pending disciplinary process.
b. Possible prosecution under State laws or local laws.
c. Loss of access to University computing resources after the disciplinary process.
d. All of the above.
Please enter a, b, c, or d: *
Your score: 100%
This assignment must be submitted via AutoLab by 11:59:59pm on Monday. Refer to AutoLab for the specific due date.