[go: up one dir, main page]

0% found this document useful (0 votes)
10 views6 pages

Lab Manual 4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Lab Manual 4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Programming Fundamentals

Lab Manual 4
Instructor: CLO:
Dr. Samyan Qayyum Wahla • CLO1
Registration Number:
Learning Objectives:
• Building in memory business application with ___________________________________________
the limited number of records Name:

___________________________________________

Guidelines/Instructions:
• Create meaningful variable names. Add comments for readability. Indent each line of your code.
• Plagiarism/Cheating is highly discouraged by assigning 0 to both who tried and one who shared his/her
code.
Project Details:
You are required to develop a University Grading System. The system stores the marks of at most five students.
The system can add, delete or update the student data. Currently only one user can login to the system which is
administrator. Administrator will have unique user name and password.
Task 1:
Write a C++ program that display the following menu. The program should take input repeatedly from the user.
On the input other than 1 to 7 system should display input is invalid, On input 0 system should stop.
Use if-else-if for checking input.
**************************************************************
University Grading System
**************************************************************
Choose the option from the menu:
Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:
Task 2:
1. Update the code written in above program; declare 5 variables, student1, student2, student3, student4 and
student 5 of type string. Assign each value as “NV”.
2. Declare 5 variables of type int marks1, marks2, marks3, marks4 and marks5, each variable for the marks
of corresponding students. Assign each variable value of -1 initially.
Task 3:
1. Change the code in the task 1 to use the switch statement in place of if-else-if.
Task 4: Count of students
1. Implement your logic on press of option 5.
2. Check each variable from student1 to student5, if the value is other than NV then increment the student
counter.
3. Display the number of variable, which have value other than NV.
Programming Fundamentals Fall 2024 Page 1 of 6
Enter Input: 5
Total Number of Students in System :4

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:

Task 5: Add a student


1. Implement the logic on press of option 1.
2. Take the student name and marks of student from user.
3. Check from student1 to student5. If any of the variable has NV value then update the value of that student
variable and corresponding marks.
4. If no variable has NV value then output that memory is full, no student can be added.
Enter Input: 1

Add a Student
Enter Student Name : Ahsan
Enter Student Marks : 78

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:

Task 6: Search a student


1. Implement the logic on press of option 2.
2. Take the name of student from user in any string variable.
3. Match the value with student variables form 1 to student 5. If the value is matched, display the marks and
grade of student.
4. Grade of student should be calculat based on following criteria.
Marks Grade
>=85 A
>=70 B
>=55 C
>=40 D
Programming Fundamentals Fall 2024 Page 2 of 6
<40 F
5. If the value is not matched, display that student cannot be found.

Enter Input: 2
Search Student
Enter Student Name : Ahsan

Student Name : Ahsan


Marks : 78
Grade :B

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:

Task 7: Delete a Student


1. Implement the logic on option 3.
2. Take the student name from user.
3. Search the student, if student is found, change that student variable to NV and marks to -1.
4. Otherwise display that no student is found.
Enter Input: 3
Delete Student Record
Enter Student Name : Ali
Student Record Not Found!

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:
Task 8: Update data of a student
1. Implement the logic on option 4.
2. Take the student name from user.
3. Search the student, if student is found, Take the new marks from user and update corresponding variables.
4. Otherwise display that no student is found.

Programming Fundamentals Fall 2024 Page 3 of 6


Enter Input: 4
Update Student Record
Enter Student Name : Ahsan

Student Name : Ahsan


Student Marks : 78
Enter Student Marks : 82
Student Record Updated SUCCESSFULLY!

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:

Task 10. Display all student without grade.


1. Implement the logic on option 6.
2. Display all student variables, which have value other than NV. Display data in two columns student name
and marks.

Enter Input: 6
Display Student Record without Grades

*********************************************************************
Student Name Marks
*********************************************************************
Muhammad Ali 86
Ayesha 72
Irum 90
Ahsan 82
*********************************************************************

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:

Programming Fundamentals Fall 2024 Page 4 of 6


Task 11. Display all student with grade.
1. Implement the logic on option 7.
2. Display all student variables which have value other than NV. Display data in three columns student name
, marks and grade
Enter Input: 7
Student Records with Grades
*********************************************************************
Student Name Marks Grades
*********************************************************************
Muhammad Ali 86 A
Ayesha 72 B
Irum 90 A
Ahsan 82 B
*********************************************************************

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:
Task 12. Close the Program
1. Implement the logic on option 0
2. Display the Thank You prompt to user to close the program
Enter Input: 0
Program close successfully!

Task 13. Login with password


1. Menu should not be displayed unless user do not enter correct username and password.
2. Currently system has only one user name and password which is as follow
UserName: Administrator
Password: PF2024
3. If the credentials are not correct, output that credentials are invalid and program should stop

Programming Fundamentals Fall 2024 Page 5 of 6


*********************************************************************
University Grading System
*********************************************************************
Please Enter the Administration Credential!
*********************************************************************
Username : Administrators
Password : PF2020
*********************************************************************

Choose the option from the menu:


Enter 1 to add a student
Enter 2 to search a student
Enter 3 to delete a student
Enter 4 to update the data of a student
Enter 5 to display number of students in the system
Enter 6 to display list of all students without grade
Enter 7 to display list of all students with grade
Enter 0 to close program
Enter Input:

Programming Fundamentals Fall 2024 Page 6 of 6

You might also like