1. When organizing a program into three files (main, class implementation, and c
ID: 1809251 • Letter: 1
Question
1. When organizing a program into three files (main, class implementation, and class header), which is not a .cpp file?
main
none are .cpp
class header
class implementation
2. Creating classes with private data members is an example of:
encapsulation
polymorphism
inheritance
abstraction
3. Given the following class definition and lines of code, Line 1 in main is a call to what?
class Distance
{
private:
int feet;
double inches;
public:
Distance( );
Distance(int initFt, double initIn);
void setFeet(int feetIn);
void setInches(double inchesIn);
int getFeet() const;
double getInches( ) const;
};
int main( )
{
Distance d1; //Line 1
const int MAX = 100; //Line 2
Distance list[MAX]; //Line 3
Distance d2(1, 2.3); //Line 4
Distance * pDist; //Line 5
d1.feet = 5; //Line 6
// etc.
Explanation / Answer
1) class header
2) polymorphism
3) feet
4) 2
5) objects
6) 5,67,8
7) double d = 10.0;
8) myFunction(emp);
9) Creates a panel which will organize its components into two rows of three columns.
10) JFrame
11) KeyEvent interface
12) import java.awt.*;
13) buttonOne.addItemListener(new ButtonHandler());
14) MyApp is a Java application.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.