Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I WOULD APPRECIATE HELP IN CODING THE FOLLOWING: PLEASE NOTE: The functions are declared in a header file named Student.h The code for the functions
I WOULD APPRECIATE HELP IN CODING THE FOLLOWING:
PLEASE NOTE: The functions are declared in a header file named Student.h
The code for the functions should be done in the class file, Student.cpp
The text files name are "Student.txt" and "Instructor.txt" I ONLY WISH TO KNOW CODE/HELP FOR STUDENT PART ONLY!!!!!!!!!!!
the code should be able to successfully get called /initialized in main.cpp that will be used for testing.
view une min, max and average ontotal course graue or all students. Introduction to the Program Structure of the program and user interactions In this assignment, you will write a program to warm up your C++ skills. This in turn will help you to prepare well for the upcoming assignments. You should create the following two classes and main.cpp to implement this program. 1. Student You will create a program to store and view grades of a 'Data Structures' class. This class has 20 students and 3 instructors. Instructor details, student details and grades are stored in two different plain text files namely instructors.txt, students.txt. Contents of these two files are o Student class should have the following methods with the exact prototype. bool login(string username, string password); string getStudentName(); . int getProjectGrade(); int getQuizGrade(): int getMidtermGrade(); . int getFinalGrade(); double getOverallGrade(); described below. 1. instructors.txt o Each line of this file represents an instructor. o Each line has username, password and full name separated by tabs. o Username is unique for each instructor. o This file is provided to you. o The provided file has 3 lines for 3 instructors. You should add necessary member variables including the following, 1 string fullName; int projectGrade; 1 int quizGrade; int midtermGrade; 2. students.txt o Each line of this file represents a student. o Each line has username, password, full name, project grade, quiz grade, midterm grade and final exam grade separated by tabs. username is unique for each student. o Grades will only be positive integers. o This file is provided to you. o The provided file has 20 lines for 20 students. int finalGrade; o Above functions must be present in the class. You can add additional functions if you wish such as the following. void setStudentName(string fullName); I void setProjectGrade(int grade); I void setQuizGrade(int grade); void setMidtermGrade(int grade); void setFinalGrade(int grade); Your program allows the users to login as a student or as an instructor. Depending on the role the user logged in can perform different tasks. Note: gradeType variable in the above methods should be recognized from the following Then the main method should initialize an Instructor object and call its login method with the integers. project: 1 quiz: 2 midterm: 3 . final: 4 user name and the password that was read from the input. The login method should read the instructors.txt file and check if the username and the password matches any of the instructors in the text file. If they match the full name of the instructor should be stored in the instructor object. In this case, login method should return true. Show the following message from the main. Here the name of the instructor is assumed to be 'John Smith'. overall: 5 You should ad necessary member variables that includes the following: 1 string fullName; o Above functions must be present in the class. You can add additional functions if you wish such as. You are now logged in as instructor John Smith. If the username or password did not match show the following message from the main. Use the return of the login method to decide the message. void setlnstructorName(string fullName); Login as instructor failed. **Note: As you can see from the description above you are allowed to add extra methods and extra data member so feel free to add any method or data members to your classes to correctly implement the logic of the assignment (explained below in the document) however methods and data members given in the class description above should be present your implement with the same prototypes You should do the same if the user selects to login as a student. Here you should initialize a student object and call its login method in the same way as explained above. In that case you should print the exact same messages for student login flow just by replacing the word instructor with the word student. If the user successfully logs in as a student you should also store the grades of the logged in student in the student object. Main method of your program should ask the following exact question from the user. User types, Student Interactions 1 - Instructor 2 - Student If the user has successfully logged in as a student, the following question should be asked. Select a login user type or enter 3 to exit: User should be able to enter 1 or 2 depending on who he/she likes to login. If the user enters Do you want to view grades (y) ? anything other than 1, 2 or 3 the following message should be shown and the above question should be asked again. User should be able to enter 'y or 'n' for the above question. If 'n' or anything other than 'y' is entered the student object should be deleted and the login options should asked again. If user entered 'y', the grades should be displayed as shown below. Invalid option. Please enter a valid option. If 3 is entered program should exit with status 0 no error. Student name: John Smith Project 80% Quiz 95% Login Flow 96% Midterm If the user selects to login as an instructor the main method should ask the following question. Final 98% Overall 91.9% Enter credentials to login, Enter username: After showing the result program should delete the student object and ask login options again. When the user enters the username the password should be asked as shown below. Instructor Interactions Enter password: view une min, max and average ontotal course graue or all students. Introduction to the Program Structure of the program and user interactions In this assignment, you will write a program to warm up your C++ skills. This in turn will help you to prepare well for the upcoming assignments. You should create the following two classes and main.cpp to implement this program. 1. Student You will create a program to store and view grades of a 'Data Structures' class. This class has 20 students and 3 instructors. Instructor details, student details and grades are stored in two different plain text files namely instructors.txt, students.txt. Contents of these two files are o Student class should have the following methods with the exact prototype. bool login(string username, string password); string getStudentName(); . int getProjectGrade(); int getQuizGrade(): int getMidtermGrade(); . int getFinalGrade(); double getOverallGrade(); described below. 1. instructors.txt o Each line of this file represents an instructor. o Each line has username, password and full name separated by tabs. o Username is unique for each instructor. o This file is provided to you. o The provided file has 3 lines for 3 instructors. You should add necessary member variables including the following, 1 string fullName; int projectGrade; 1 int quizGrade; int midtermGrade; 2. students.txt o Each line of this file represents a student. o Each line has username, password, full name, project grade, quiz grade, midterm grade and final exam grade separated by tabs. username is unique for each student. o Grades will only be positive integers. o This file is provided to you. o The provided file has 20 lines for 20 students. int finalGrade; o Above functions must be present in the class. You can add additional functions if you wish such as the following. void setStudentName(string fullName); I void setProjectGrade(int grade); I void setQuizGrade(int grade); void setMidtermGrade(int grade); void setFinalGrade(int grade); Your program allows the users to login as a student or as an instructor. Depending on the role the user logged in can perform different tasks. Note: gradeType variable in the above methods should be recognized from the following Then the main method should initialize an Instructor object and call its login method with the integers. project: 1 quiz: 2 midterm: 3 . final: 4 user name and the password that was read from the input. The login method should read the instructors.txt file and check if the username and the password matches any of the instructors in the text file. If they match the full name of the instructor should be stored in the instructor object. In this case, login method should return true. Show the following message from the main. Here the name of the instructor is assumed to be 'John Smith'. overall: 5 You should ad necessary member variables that includes the following: 1 string fullName; o Above functions must be present in the class. You can add additional functions if you wish such as. You are now logged in as instructor John Smith. If the username or password did not match show the following message from the main. Use the return of the login method to decide the message. void setlnstructorName(string fullName); Login as instructor failed. **Note: As you can see from the description above you are allowed to add extra methods and extra data member so feel free to add any method or data members to your classes to correctly implement the logic of the assignment (explained below in the document) however methods and data members given in the class description above should be present your implement with the same prototypes You should do the same if the user selects to login as a student. Here you should initialize a student object and call its login method in the same way as explained above. In that case you should print the exact same messages for student login flow just by replacing the word instructor with the word student. If the user successfully logs in as a student you should also store the grades of the logged in student in the student object. Main method of your program should ask the following exact question from the user. User types, Student Interactions 1 - Instructor 2 - Student If the user has successfully logged in as a student, the following question should be asked. Select a login user type or enter 3 to exit: User should be able to enter 1 or 2 depending on who he/she likes to login. If the user enters Do you want to view grades (y) ? anything other than 1, 2 or 3 the following message should be shown and the above question should be asked again. User should be able to enter 'y or 'n' for the above question. If 'n' or anything other than 'y' is entered the student object should be deleted and the login options should asked again. If user entered 'y', the grades should be displayed as shown below. Invalid option. Please enter a valid option. If 3 is entered program should exit with status 0 no error. Student name: John Smith Project 80% Quiz 95% Login Flow 96% Midterm If the user selects to login as an instructor the main method should ask the following question. Final 98% Overall 91.9% Enter credentials to login, Enter username: After showing the result program should delete the student object and ask login options again. When the user enters the username the password should be asked as shown below. Instructor Interactions Enter password
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started