Commit 4d7a7eee authored by Eddy Marinez's avatar Eddy Marinez

Student.h

parent 899b96b2
// *****************************************************************************
// 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;
}
\ No newline at end of file
......@@ -8,6 +8,8 @@
// ***********************************************************************
#include <string>
#include "Questions.h"
#include "Student.cpp"
using namespace std;
......@@ -16,48 +18,32 @@ using namespace std;
class Student {
public:
// Default constructor
Student() {
userName = "NoName";
}
//Default constructor for only a username
Student();
Student(string userNameIn) {
userName = userNameIn;
}
Student(string userNameIn);
// Default constructor for a username and level
Student(string userNameIn, int levelIn) {
userName = userNameIn;
level = levelIn;
}
// Copy constructor
Student(const Student& studentIn) {
userName = studentIn.userName;
level = studentIn.level;
}
Student(string userNameIn, int levelIn);
// Accessors
int getLevel() {
return level;
}
string getUserName() {
return userName;
}
int getLevel();
string getUserName();
//Student functions.
void displayMenu();
void testingStage();
void displayMenu(); //Display menu; show the current level, option to practice or log out.
//menu options
void practice(); //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 testingStage(); //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.
// Mutators
void setLevel(int levelIn) {
level = levelIn;
}
void setLevel(int levelIn);
void setUserName(string userNameIn) {
userName = userNameIn;
}
void setUserName(string userNameIn);
private:
string userName;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment