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

Info iconThis 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
Background image of page 1

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

View Full DocumentRight 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
Background 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
Background image of page 3

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

View Full DocumentRight 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
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

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

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online