COSC 236
Part 2
Due May 2018
Modify your code from part 1 so that instructors can also use your program. Change your login method to recognize if the username/password entered belong to a student or instructor (based on the last column in the UsersInfo.txt file). If the user is a student, you will need to go with the regular path (start the quiz). If the user is an instructor, display the following options as a menu:
Register a new student.Ask the instructor to entera student’s information: first name, last name, username, email.The password needs to be generated automatically. All the information will then be added to the Users_Info.txt file.
2) Displaystats
Display on screen the following stats: the studentwith the shortest duration, highest grade, the lowest grade and average grade of the class. (Hint: upon a successful completion of each quiz, write the student’s name, elapsed time and score to a file, use this to extract the stats listed above).
3) Add new questions
Allow the instructor to add new questions to the test bank. The questions can be added in two ways: 1) manually by typing the question and the answer. 2) by providing a file name to be read and appended to the original test bank.
Solution - With All Java and Text Files..
import java.io.*;import java.util.*;import java.text.SimpleDateFormat;
public class Project2{ // Start the Game public static void StartQuiz(String uN,long stime,String StartDT) throws IOException{ String uN1,stDTime; final int SIZE=125; String Test[] = null; File answers = new File("TestBank.txt"); Scanner inputTest = new Scanner(answers); uN1 = uN; stDTime = StartDT; File test = new File("Answers.txt"); Scanner inputAnswers = new Scanner(test);
int testcounter = 0; int answercounter = 0; int correctcounter = 0; String[] userAns = new String[10]; String[] correctAns = new String[10]; int i=0; int j=0; while (testcounter < 10 && answercounter < 10) {
// for more Please download the Solution
COSC 236 Part 2 Solution
SKU: VITS100007
$25.00Price