Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 4 [33] Note: Read through the whole of Question 4 below before you attempt to answer the questions that follow Also, provide only the

image text in transcribed
image text in transcribed
QUESTION 4 [33] Note: Read through the whole of Question 4 below before you attempt to answer the questions that follow Also, provide only the member functions requested and required by the question The Exams department keeps a file with a list of all the modules in which exams are written for each module, the module code and module name are stored in the file Exams.dat Once the exam timetable has been determined the file Exams.dat needs to be updated with the number of students who will write the exam as well as the date on which the exam will be written However, every exam period, the same exams are written The Exams department, therefore wants to keep the file Exams dat intact They require a program that will copy the contents of the file Exams.dat to another file called Exams Detail.dat in which the number of students who will write the exam as well as the date on which the exam will be written, have been added to the module code and module name for each exam This will create a record for each exam in file Exams Detail.dat TURN OVER COS1512 Oct Nov 2019 Complete the program below, using separate compilation, to assist the Exams Department The program uses a class Exam This class has four member vanables mCode, a string for the module code mName, a string for the module name . nr students, an integer value to indicate the number of students who will wnte the exam examDate, a strong for the date on which the exam will be written In addition, the class Exam has the following member functions A default constructor that initialises all the strings to empty strings, and the integer member vanable to o An overloaded constructor to initialise member vanables to specified values A destructor An accessor getCode() A mutator setDate() An overloaded stream extraction operator>> implemented as a friend function, to read an Exam object from a file An overloaded stream insertion operator > number: cout > date, //5 Instantiate an object anExam using the 1/overloaded constructor to initialise the object with the values //obtained 1/6. Output object anexam to tale //ExamsDetail.dat 7 //7.close files return 0. 44 Complete the code fragment below to update the exam date for a module The internal filename input file has been associated with the input file, and has been opened successfully This file is used as input file in the whale loop The updated exam object as well as unaltered exam objects are copied to an output file with an internal filename output file This file has also been opened successfully (5) string newdate; cout > code: cout > newdate: 2 whale 7/1. Instantiate an object aExam for an exam using //the default constructor //2. Read an object aExam from the // input file 3 7/3. Compare variable code wath the 1/member variable Code an object aExam //4. Set nember variable exampate in 1/object aExam to the new date for the exam J/5. Output object Exam to the output file 4 TURN OVER

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

LO3 Outline strategic compensation decisions.

Answered: 1 week ago

Question

Analyse the process of new product of development.

Answered: 1 week ago

Question

Define Trade Mark.

Answered: 1 week ago