{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

test 15 corrections - Course Philosophy Dr Pryor FAQ's TA...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Course Philosophy Dr. Pryor FAQ's TA Page Office Hours Other Resources Syllabus Tutorials Countdown to the due date: 7 days, 20 hours, 28 minutes Home » PHP Script - testTake bam2734 My account Log out Test Center
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Units and Reviews 00 01 02 03 04/R1 05 06 07 08 09/R2 10 11 12 13/R3 14 15 16 PHP Script - testTake Your Previously Submitted Test 1. Answer the follow questions. a. (true/false) Class declarations always end with a semicolon. b. (true/false) Since #include simply adds the code to the top of your program before compiling, you could simply declare your class at the top of your main.cpp file. c. Where in your code can you call a method that is private? d. (true/false) A class can have multiple Constructor e. (true/false) The following line of code (cout << *this << endl;) in a class method will only compile if the << operator is overridden for that class. a. False b. False c. Only inside the class's method
Image of page 2
d. True e. It would print whatever the pointer was referencing to. 2. Correct the following header file class declaration. Correct both design and syntax errors. #ifndef TIME_H #define TIME class Time; { private: Time( int hour, int minute, float second ); Time( ); Time TimeElapsed( double stopTime ); float GetSeconds( ); float GetMinutes( ); void GetHours( ); void PrintTime( ) public: int hour; double minute; int second = 0; }; #endif Submit the code for Time.h that will compile when used with the following main.cpp code. #include #include "Time.h" using namespace std; int main(){ Time time(1,10,55); time.PrintTime(); return 1; } Time::Time( int hour, int minute, int second ){ this->hour = hour; this->minute = minute; this->second = second; } void Time::PrintTime(){ cout << hour <<":" << minute <<":" << second << endl; } #ifndef TIME_H
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
#define TIME_H class Time { public: Time( ); Time( int hour, int minute, int second ); Time TimeElapsed( double stopTime ); float GetSeconds( ); float GetMinutes( ); float GetHours( ); void PrintTime( ); private: int hour; int minute; int second; }; #endif 3. Starting with the ComplexNumber class given in the unit, make both the imaginary and real components private. Create GetReal, SetReal, GetImaginary, and
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern