Student.cpp 3.43 KB
Newer Older
Eddy Marinez's avatar
Eddy Marinez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
// *****************************************************************************
// Author: Eddy Marinez
// Implemenation file for Student class
// Comments should explain everything
// ****************************************************************************
#include <string>
#include "Questions.h"
#include "Student.h"
#include <iostream>

using namespace std;

// Default Constructor
// Input: none
// Output: object with Student username of NULL
Student::Student(){
    userName = "NULL";
}

// Default Constructor
// Input: username of student 
// Output: object with student username of NULL
Student::Student(string userNameIn) {
    userName = userNameIn;
}

// Default Constructor
// Input: username and level 
// Output: object with student username of NULL
Student::Student(string userNameIn, int levelIn) {
    userName = userNameIn;
    level = levelIn;
}

// Runs student Menu
// Input: A user's menu selection
// Output: Changes are made based on users input
void Student::displayMenu(){
    int choice;
    cout << endl << "Student Menu." << endl << endl;
    cout << "1. Practice Level #"<< getLevel() << endl;
    cout << "2. Log Out" << endl;
    cin >> choice;
    if (cin){
        switch(choice){
            case 1: // Practice
            
                break;
            case 2: // Log Out 
                cout << "Goodbye." << endl;
                break;
            default:
                cout << "Invalid choice.\n";
                break;                
        }
    }else {
        cin.clear();
        cin.ignore(100,'\n');
         cout << "Invalid choice.\n";
    }
}

//menu options
//Practice: referenced with the questiones.h file, ask questions until they ge 3-5 right.
//Practice: present the option to enter testing mode.
//Practice:  if yes. enter testing mode as bellow, if no. continue practicing for another 3-5 questions.
void practice(){
    int count =0;
    char choice;
    bool gotitGood, testing;
    do{
        gotitGood=Questions::mainQuestionAsk(getLevel());
        if(gotitGood==true){
            couter++;
        }if(counter>=3){
            do{
                cout << "Would you like to test out? (Y)es/(N)o ";
                cin >> choice;
                if(choice == 'Y'){
                    testingStage();
                    testing = true;
                    break;
                }else if(choice == 'N'){
                    counter=0;
                    break;
                }else{
                    cout << "Invalid input." <<endl;
                    continue;
                }
            }while(true);
        }
    }while(testing == false);
} 

//Testing Stage: same difficulty questions, and they will be given a set number of them (10, 15, 20)
//Testing Stage: congratulate if they get enough right. increment dificulty level.
//Testing Stage: exit testing mode and go back to menu.
void testingStage(){
int count =0;
    int levelIn = getLevel();
    char choice;
    bool testOut, finish;
    while{
        testOut=Questions::mainQuestionAsk(getLevel());
        if(testOut==true){
            couter++;
        }if(counter>=5){
            cout << "Congratulations! you have passed." << endl;
            setLevel(levelIn)++;
        }
    }    
}


// Accessors
int Student::getLevel() {
    return level;
}
string Student::getUserName() {
    return userName;
}
// Mutators
void Student::setLevel(int levelIn) {
    level = levelIn;
}

void Student::setUserName(string userNameIn) {
    userName = userNameIn;
}