/*-------------------------------------------------*/ /* */ /* CSIS 2610 Lab 2 */ /* Arithmetic, Built-in functions, a simple if */ /* */ /* Sam Litowitz */ /* */ /*-------------------------------------------------*/ /*---------------------------------------------------------*/ /* */ /* #includes */ /* */ /*---------------------------------------------------------*/ #include #include #include /*-------------------------------------------------*/ /* */ /* Variable Declarations */ /* */ /*-------------------------------------------------*/ int StudentID; //int Freshman = 1, Sophmore = 2, Junior = 3, Senior = 4; int Class; int TestOne, TestTwo, FinalExam; int LabOne, LabTwo, LabThree, LabFour, LabFive, LabSix, LabSeven, LabEight; float PointTotal; const float TestOnePercent = .26; const float TestTwoPercent = .26; const float FinalPercent = .26; const float LabPercent = .22; const float LabScalingFactor = 1.25; /*---------------------------------------------------------*/ /* */ /* Input Function */ /* */ /*---------------------------------------------------------*/ int GetIntInput(std::string const &message) { int Temp = 0; bool badInput = false; std::cout << message; do { std::cin >> Temp; if(!std::cin) { badInput = true; std::cin.clear(); std::cin.ignore(std::numeric_limits::max(),'\n'); } else { badInput = false; } } while(badInput); return Temp; } /*---------------------------------------------------------*/ /* */ /* Main module */ /* */ /*---------------------------------------------------------*/ int main () { /*---------------------------------------------------------*/ /* */ /* Get ID, Class, and Score input */ /* */ /*---------------------------------------------------------*/ //std::cout << "\033[2J\033[H"; bool badTemp = false; StudentID = GetIntInput("Student ID: "); Class = GetIntInput("Class: \n1: Freshman\n2: Sophmore\n3: Junior\n4: Senior\n"); TestOne = GetIntInput("Test One Score: "); TestTwo = GetIntInput("Test Two Score: "); FinalExam = GetIntInput("Final Exam Score: "); LabOne = GetIntInput("Lab One Score: "); LabTwo = GetIntInput("Lab Two Score: "); LabThree = GetIntInput("Lab Three Score: "); LabFour = GetIntInput("Lab Four Score: "); LabFive = GetIntInput("Lab Five Score: "); LabSix = GetIntInput("Lab Six Score: "); LabSeven = GetIntInput("Lab Seven Score: "); LabEight = GetIntInput("Lab Eight Score: "); /*---------------------------------------------------------*/ /* */ /* Total Points */ /* */ /*---------------------------------------------------------*/ int LabPoints = LabOne + LabTwo + LabThree + LabFour + LabFive + LabSix + LabSeven + LabEight; PointTotal = TestOnePercent * TestOne + TestTwoPercent * TestTwo + FinalPercent * FinalExam + LabPercent * LabPoints * LabScalingFactor; /*---------------------------------------------------------*/ /* */ /* Output Information */ /* */ /*---------------------------------------------------------*/ system("clear"); std::cout << "1234567890123456789012345678901234567890123456789012345678901234567890" << std::endl; std::cout << "Here is the "; if(Class == 1) std::cout << "freshman's "; else std::cout << "YSU Student's"; std::cout << " Point Total" << std::endl << std::endl; std::cout << "Student" << std::endl; std::cout << " ID Points" << std::endl; std::cout << StudentID << " " << PointTotal << std::endl; return 0; }