1) Assume that we want to build an application for special type of exams. The exam...
Fantastic news! We've Found the answer you've been seeking!
Transcribed Image Text:
1) Assume that we want to build an application for special type of exams. The exam includes True/False questions. The number of questions per exam varies from one exam to other. Given below Question class, where each True/False question has a text and a correct answer. Assume the class is implemented and ready for use: class Question { public: Question(string, bool); Question(); -Question(); void Set Text(string); string Get Text(); void SetAnswer(bool); bool GetAnswer(); private: string text; bool correctanswer; Write a new class called Exam. In this class, the exam has variable number of questions. In the Exam class, please define the following: 1. Two member variables, one called count of type int which will have number of questions in the exam, and other member variable called questions of type Question that will track the questions of the exam. Questions member variable should allow a dynamic array of questions. (5 points) 2. A constructor Exam(int num) where num is the number of questions in exam. (6 points) 3. A destructor (5 points) 4. A member function called void LoadQuestions(), this function will load the exam questions from user input. The user will be asked to insert a text and a correct answer for each exam question. (10 points) 5. A member function called Question GetQuestion(int question_index) which receives the index of the question and returns the exam Question of that index. (5 points) 6. A member function called int GetCount() which returns the number of questions in the exam. Note, make this function read only which means cannot modify Exam class objects. (5 points) Q2) Assume that the previous two classes (Question and Exam) are implemented and ready for use. Write a new class called Student Answer that will track students' answers for specific tests. The class prototype is as the following: class StudentAnswer { public: Student Answer(Exam *); -Student Answer(); void TakeExam(); float GetScore(); private: Exam* taken_exam; bool * answers; Note that the taken_exam member variable is used to track which exam is being taken. The answers member variables is used to track the student's answers of the taken_exam. Write the following functions: 1. The constructor StudentAnswer(Exam *) (6 points) 2. The member function TakeExam which will loop through exam questions one by one, and ask the student to enter answer for each one (T for true and F for false) and store student's answers inside answers member variable (array). (10 points) 3. The member function GetScore which will return the score assume the exam has been taken and answers are stored. (10 points) Write a main function that uses the Exam and StudentAnswer classes and does the following: 1. Create two exam objects, one called math with 30 question and one called OOP with 40 questions. Load questions for each one. (10 points) 2. Create one student answer SA1 for the math exam and another student answer SA2 for the OOP exam. Collect answers by calling take test for each one. Print final scores for each test. (10 points) 1) Assume that we want to build an application for special type of exams. The exam includes True/False questions. The number of questions per exam varies from one exam to other. Given below Question class, where each True/False question has a text and a correct answer. Assume the class is implemented and ready for use: class Question { public: Question(string, bool); Question(); -Question(); void Set Text(string); string Get Text(); void SetAnswer(bool); bool GetAnswer(); private: string text; bool correctanswer; Write a new class called Exam. In this class, the exam has variable number of questions. In the Exam class, please define the following: 1. Two member variables, one called count of type int which will have number of questions in the exam, and other member variable called questions of type Question that will track the questions of the exam. Questions member variable should allow a dynamic array of questions. (5 points) 2. A constructor Exam(int num) where num is the number of questions in exam. (6 points) 3. A destructor (5 points) 4. A member function called void LoadQuestions(), this function will load the exam questions from user input. The user will be asked to insert a text and a correct answer for each exam question. (10 points) 5. A member function called Question GetQuestion(int question_index) which receives the index of the question and returns the exam Question of that index. (5 points) 6. A member function called int GetCount() which returns the number of questions in the exam. Note, make this function read only which means cannot modify Exam class objects. (5 points) Q2) Assume that the previous two classes (Question and Exam) are implemented and ready for use. Write a new class called Student Answer that will track students' answers for specific tests. The class prototype is as the following: class StudentAnswer { public: Student Answer(Exam *); -Student Answer(); void TakeExam(); float GetScore(); private: Exam* taken_exam; bool * answers; Note that the taken_exam member variable is used to track which exam is being taken. The answers member variables is used to track the student's answers of the taken_exam. Write the following functions: 1. The constructor StudentAnswer(Exam *) (6 points) 2. The member function TakeExam which will loop through exam questions one by one, and ask the student to enter answer for each one (T for true and F for false) and store student's answers inside answers member variable (array). (10 points) 3. The member function GetScore which will return the score assume the exam has been taken and answers are stored. (10 points) Write a main function that uses the Exam and StudentAnswer classes and does the following: 1. Create two exam objects, one called math with 30 question and one called OOP with 40 questions. Load questions for each one. (10 points) 2. Create one student answer SA1 for the math exam and another student answer SA2 for the OOP exam. Collect answers by calling take test for each one. Print final scores for each test. (10 points)
Expert Answer:
Answer rating: 100% (QA)
Question 1 Code class Exam public Examint num Exam void LoadQuestions Question GetQuestionint questionindex int GetCount const private int count Question questions ExamExamint num count num questions ... View the full answer
Related Book For
Statistics Unlocking the Power of Data
ISBN: 978-1118583104
1st edition
Authors: Robin H. Lock, Patti Frazer Lock, Kari Lock Morgan, Eric F. Lock, Dennis F. Lock
Posted Date:
Students also viewed these mathematics questions
-
Suppose that we want to investigate the question Does voter turnout differ by political party? How might we collect data to answer this question? What would the cases be? What would the variable(s)...
-
Suppose that we want to store digitized audio information in a binary file. An audio signal typically does not change much from one sample to the next. In this case, less memory is used if we record...
-
Suppose that we want to translate constant expressions into the postfix, or reverse Polish notation of logician Jan ukasiewicz. Postfix notation does not require parentheses. It appears in...
-
On December 1, 2011, Lavender Manufacturing Company (a corporation) purchased another company's assets, including a patent. The patent was used in Lavender's manufacturing operations; $49,500 was...
-
Calculate Canadian depreciation and net investment during 2010. Statistics Canada reported that the capital stock was $6,113 billion at the end of 2008, $6,266 billion at the end of 2009, and $6,510...
-
Spectrum provides cable television and Internet service to millions of customers. Suppose that the management of Spectrum subjectively assesses a probability distribution for the number of new...
-
According to the SEC, which is not a sign of a possible fraudulent company a. Insiders having greater than 50 percent control of the BOD. b. CEO also being chairman of the BOD. c. CEO being the...
-
Bill Binder's business nearly went under when Colorado almost passed the bottle bill. Binder's Beverage produced soft drinks for many of the large grocery stores in the area. After the bottle bill...
-
WACC Assignment (Week 11)You recently went to work for CTC Components Company, a supplierof auto repair parts used in the after-market with products fromDaimler AG, Ford, Toyota, and other automake 2...
-
Lessee Ltd (1.e., the lessee) signed a contract with Lessor Ltd (1.e., the lessor) to lease items of office equipment. You are provided with the following lease details: Commencement date Lease term...
-
Charleston Handcrafted Tables (CHT) manufactures coffee tables made of recycled timber. To assist in their decision-making, the management accountant has supplied the following information: Expected...
-
Diagram or explain the existing cost system used at Voltaic Vehicles to assign costs to CEV and GEV. Clearly define the allocation bases as well as the rates used to assign these costs. 2. What is...
-
Michelle, a single nurse at the local hospital (with no dependants) received $105,000 in wages and a $5,000 fully franked dividend. She has work related expenses of $2,000 and is also undertaking a...
-
Fredrick is an Australian resident and have recently purchased an established home in SA for a purchase price of $550,000, settlement date being 31st July 2022. They are the first home buyers and...
-
George's T-Shirt Shop produces 2,000 custom-printed T-shirts per month. George's fixed costs are $6,000 per month. The marginal cost per T-shirt is a constant $6. George's break-even price is per...
-
QM sells a range of mobile phones. A customer can also purchase an extended warranty when purchasing a mobile phone. The extended warranty takes effect after the manufacturer's warranty ends. The...
-
CASE 3: Where to live (cost-benefit analysis) If you are a real estate manager, you need to analyze information in table 1 and table 2 to help your customers to find apartments to live. Table 1...
-
In Problems 1522, find the principal needed now to get each amount; that is, find the present value. To get $750 after 2 years at 2.5% compounded quarterly.
-
Test H 0 : μ 1 = μ 2 vs H a : μ 1 > μ 2 using the paired data in the following table: Use a t-distribution and the given matched pair sample...
-
It is generally recommended that adults sleep at least 8 hours each night. One of the authors recently asked some of her students (undergraduate and graduate students at Harvard) how many hours each...
-
The Scholastic Aptitude Test (SAT) was taken by 1,547,990 college-bound students in the class of 2010. The test has three parts: Critical Reading, Mathematics, and Writing. Scores on all three parts...
-
Everyone has a different tolerance for risk. Some people will try anything once, including skydiving and whitewater rafting. Others take every precaution to avoid danger.
-
What are the main types of investment alternatives?
-
A friend wants to invest a \($500\) bonus she received. What would you advise?
Study smarter with the SolutionInn App