Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++. Student Name, Student number, GPA Sample: Abraham Simpson,324543,3.9 Agnes Skinner,470546,4.0 Akira Kurosawa,411928,2.1 Alice Glick,459608,3.3 A header file containing a structure for the GPA

in c++. Student Name, Student number, GPA Sample: Abraham Simpson,324543,3.9 Agnes Skinner,470546,4.0 Akira Kurosawa,411928,2.1 Alice Glick,459608,3.3 A header file containing a structure for the GPA record of a student under the name "GPA.h": /*********************************************************************** // OOP244 Workshop 1 p2: GPA header file // // File GPA.h // Version 1.0 // Date winter 2023 // Author Fardad Soleimanloo // // // Revision History // ----------------------------------------------------------- // Name Date Reason ///////////////////////////////////////////////////////////////// ***********************************************************************/ #ifndef SDDS_GPA_H #define SDDS_GPA_H struct GPA { char name[116]; double gpa; int stno; }; #endif // !SDDS_GPA_H Write a command line program that receives an operation and a GPA value and performs the following queries on the records of the data file. command line format: ? [operation][GPA Value] Examples: ? <3.6 [ENTER] list all the GPA records less than 3.6 ? >3.9 [ENTER] list all the GPA records more than 3.9 ? ~3.0 [ENTER] list all values close to 3.0 with 0.05 precision (between 2.95 and 3.05) ? ! End query Your program should work under a function called gpaQuery. gpaQuery bool gpaQuery(const char* filename); This function returns false if the filename can not be opened for reading, otherwise, it will return true. gpaQuery runs as follows: Data entry: @2.2 ~3.7 ~3.8 <2.0 >3.8 ~3.9 ! V1.1 sort the output based on student number (stno) in ascending order instead of GPA Using the above data The function should work as follows: Enter GPA query... ? @2.2 Syntax error: ? [Op][value] Op: [>,<,~,!] value: GPA value ? ~3.7 [1] 231018: 3.7 (Ruth Powers) [2] 234272: 3.7 (Comic Book Guy) [3] 362030: 3.7 (Chazz Busby) [4] 544294: 3.7 (Sea Captain) ? ~3.8 [1] 217994: 3.8 (Selma Bouvier) ? <2.0 [1] 134681: 1.8 (Wise Guy) [2] 194002: 1.8 (Squeaky-Voiced Teen) [3] 262592: 1.7 (Barney Gumble) [4] 383513: 1.7 (Gil Gunderson) [5] 394769: 1.9 (Troy McClure) [6] 434336: 1.7 (Seymour Skinner) [7] 533451: 1.8 (Judge Roy Snyder) [8] 568727: 1.7 (Kent Brockman) [9] 584416: 1.7 (Brandine Spuckler) [10] 667331: 1.9 (Jessica Lovejoy) [11] 677806: 1.7 (Wendell Borton) [12] 686009: 1.8 (Helen Lovejoy) [13] 695606: 1.6 (Kirk Van Houten) [14] 753102: 1.8 (Bart Simpson) [15] 877842: 1.6 (Edna Krabappel) [16] 950955: 1.8 (Snake Jailbird) ? >3.8 [1] 155387: 3.9 (Baby Gerald) [2] 242653: 3.9 (Bernice Hibbert) [3] 249669: 4.0 (Ling Bouvier) [4] 290816: 4.0 (Apu Nahasapeemapetilon) [5] 324543: 3.9 (Abraham Simpson) [6] 470546: 4.0 (Agnes Skinner) [7] 570423: 4.0 (Lindsey Naegle) [8] 736389: 4.0 (Disco Stu) [9] 829982: 3.9 (Dolph Starbeam) [10] 901832: 4.0 (Krusty The Clown) ? ~3.9 [1] 155387: 3.9 (Baby Gerald) [2] 242653: 3.9 (Bernice Hibbert) [3] 324543: 3.9 (Abraham Simpson) [4] 829982: 3.9 (Dolph Starbeam) ? ! Exit the program? (Y)es/(N)o: y Goodbye! Modules Implement your program in three modules: GPAlist: (must contain the gpaQuery function) File: hold file-related functions UI: holding User interaction functions. Tester program /*********************************************************************** // OOP244 Workshop 1 p2: tester program // // File main.cpp // Version 1.0 // Date winter 2023 // Author Fardad Soleimanloo // // // Revision History // ----------------------------------------------------------- // Name Date Reason ///////////////////////////////////////////////////////////////// ***********************************************************************/ #include #include "GPAlist.h" using namespace sdds; int main() { if(gpaQuery("std.csv")) { std::cout << "This should have failed!" << std::endl; } else { std::cout << "failed!, this is the correct exectution" << std::endl; } if(!gpaQuery("students.csv")) { std::cout << "This should have worked, fix the problem!" << std::endl; } printf("Goodbye!"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

Please answer in this format. Thanks in advance!

Answered: 1 week ago