Unformatted text preview:

CSCI 2720 Assignment 1: Introduction to C++ Programming Due: June 17, 2020 11:59PM Introduction to the Program 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 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 described below. 1. instructors.txt ○ Each line of this file represents an instructor. ○ Each line has username, password and full name separated by tabs. ○ Username is unique for each instructor. ○ This file is provided to you. ○ The provided file has 3 lines for 3 instructors. 2. students.txt ○ Each line of this file represents a student. ○ 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. ○ Grades will only be positive integers. ○ This file is provided to you. ○ The provided file has 20 lines for 20 students. 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. If the user logged in as a specific student, the user can view his/her grades for project, quiz, midterm, and final exam. The user also can view the total course grade. Overall course grade should be calculated using the following weights. ● project - 30% ● quiz - 10% ● midterm - 20% ● final exam - 40%If the user logged in as a specific instructor, the instructor can perform the following tasks. ● View grades of a specific student by entering the student’s username. ● View the min, max and average grades of all students for project, quiz, midterm or final exam separately. ● View the min, max and average of total course grade of all students. Structure of the program and user interactions You should create the following two classes and main.cpp to implement this program. 1. Student ○ 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(); ○ You should add necessary member variables including the following, ■ string fullName; ■ int projectGrade; ■ int quizGrade; ■ int midtermGrade; ■ int finalGrade; ○ Above functions must be present in the class. ○ You can add additional functions if you wish such as the following. ■ void setStudentName(string fullName); ■ void setProjectGrade(int grade); ■ void setQuizGrade(int grade); ■ void setMidtermGrade(int grade); ■ void setFinalGrade(int grade); 2. Instructor ○ Instructor class should have the following methods with the exact prototype. ■ bool login(string username, string password); ■ string getInstructorName(); ■ Student getStudent(string username); ■ Student getMinStudent(int gradeType); ■ Student getMaxStudent(int gradeType); ■ double getAvg(int gradeType);○ Note: gradeType variable in the above methods should be recognized from the following integers. ■ project: 1 ■ quiz: 2 ■ midterm: 3 ■ final: 4 ■ overall: 5 ○ You should add necessary member variables that includes the following: ■ string fullName; ○ You can add additional functions if you wish such as. ■ void setInstructorName(string fullName); **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 Main method of your program should ask the following exact question from the user. User types, 1 - Instructor 2 - Student 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 anything other than 1, 2 or 3 the following message should be shown and the above question should be asked again. Invalid option. Please enter a valid option. If 3 is entered program should exit. Login Flow If the user selects to login as an instructor the main method should ask the following question. Enter credentials to login, Enter username: When the user enters the username the password should be asked as shown below. Enter password:Then the main method should initialize an Instructor object and call its login method with the 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’. 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. Login as instructor failed. 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. Student Interactions If the user has successfully logged in as a student, the following question should be asked. Do you want to view grades (y/n)? User should be able to enter ‘y’ or ‘n’ for the above question. If ‘n’ or anything other than ‘y’ is entered the login options should asked again. If user entered ‘y’, the grades should


View Full Document

UGA CSCI 2720 - Assignment-1

Documents in this Course
Load more
Download Assignment-1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Assignment-1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Assignment-1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?