Suppose a
class CheckPoint
{
private:
int a;
protected:
int b;
int c;
void setA(int x ) {a= x;}
public:
void setB(int y) { b = y;}
void setC(int z ) { c = z ;}
};
Answer the following questions.
A) Suppose another class, Quiz, is derived from the CheckPoint class. Here is
the first line of its declaration:
class Quiz : private CheckPoint
Indicate whether each member of the CheckPoint class is private, protected, public, or inaccessible:
a
b
c
setA
setB
setC
B) Suppose the Quiz class, derived from the CheckPoint class, is declared as
class Quiz : protected Checkpoint
Indicate whether each member of the CheckPoint class is private, protected, public, or inaccessible:
a
b
C
setA
setB
setC
C) Suppose the Quiz class, derived from the CheckPoint class, is declared as
class Quiz : public Checkpoint
Indicate whether each member of the CheckPoi nt class is private, protected, public, or inaccessible:
a
b
C
setA
setB
setC
D) Suppose the Quiz class, derived from the CheckPoint class, is declared as
class Quiz: Checkpoint
Is the CheckPoint class a private, public, or protected base class?
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
Starting Out with C++: Early Objects
Additional Engineering Textbook Solutions
Electric Circuits. (11th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Management Information Systems: Managing The Digital Firm (16th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Degarmo's Materials And Processes In Manufacturing
- Nutritional information (classes/constructors) PYTHON ONLY Complete the FoodItem class by adding a constructor to initialize a food item. The constructor should initialize the name (a string) to "None" and all other instance attributes to 0.0 by default. If the constructor is called with a food name, grams of fat, grams of carbohydrates, and grams of protein, the constructor should assign each instance attribute with the appropriate parameter value. The given program accepts as input a food item name, fat, carbs, and protein and the number of servings. The program creates a food item using the constructor parameters' default values and a food item using the input values. The program outputs the nutritional information and calories per serving for both food items. Ex: If the input is: M&M's10.034.02.01.0 where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 1.0 is the number of servings, the output is:…arrow_forward// Is my code correct? //please make it more efficient as you can. Thank you //please correct it if there is some mistakes public class PartTimeEmployee extends Person { //private variables private double payRate; private double hoursWorked; public PartTimeEmployee() { super(); /*invokes the default constructor of class Person */ payRate = 0; hoursWorked = 0; } public PartTimeEmployee(String idPerson, String nameFirst, String nameLast, String date, String addressPerson, double pay, double hours) { super(idPerson, nameFirst, nameLast, date, addressPerson); /*invokes the non-default constructor in other words, override the parameters from Person() non-defaukt with another set of parameters, example 'idPerson' variable overrides 'id' in Person() */ this.payRate = pay; this.hoursWorked = hours; } public String toString(String idPerson,…arrow_forwardNumber 25arrow_forward
- PROGRAMMING LANGUAGE: C++ Write a program that has a base class named FlightCrew. This class shouldhave three data members: an integer to store the ID of the crew member, aninteger to store the number of years of service and another integer to storethe total salary of the member. Provide a parameterized constructor in theclass to set the values of the data members.Derive a class Pilot from FlightCrew to contain two additional data members,an integer to store the number of hours of flight and a boolean to storewhether the Pilot has military experience or not. Provide a paramete rizedconstructor in the Pilot class. Provide a function bonus() in the class wherethe bonus of a pilot is his number of flight hours times the 10% of his salary.Likewise, provide a function isEligible() in the class to find out if the pilot iseligible for promotion or not. A pilot is eligible for promotion to the nextrank if he has at least 5 years of experience and the number of total flighthours is greater…arrow_forwardInstructions-Java Assignment is to define a class named Address. The Address class will have three private instance variables: an int named street_number a String named street_name and a String named state. Write three constructors for the Address class: an empty constructor (no input parameters) that initializes the three instance variables with default values of your choice, a constructor that takes the street values as input but defaults the state to "Arizona", and a constructor that takes all three pieces of information as input Next create a driver class named Main.java. Put public static void main here and test out your class by creating three instances of Address, one using each of the constructors. You can choose the particular address values that are used. I recommend you make them up and do not use actual addresses. Run your code to make sure it works. Next add the following public methods to the Address class and test them from main as you go: Write getters and…arrow_forwardConsider the following class: public class theClass { private double value; private string str; public static int count; public theClass () { } public theClass (double d, int, x, String s) { } public void print() { } public static void incrementCount() { } } a) How many members do class theClass have? b) Compare the purpose of the two constructors. c) Use the reference this to write the definition of a method print( )to output the value of the instance data members separated by commas. d) Write a statement to create an object myClass of the class theClass and initialise the instance variables to 5, 10.75 and the string Class. e) Write a definition (heading) for a copy constructor for the class.arrow_forward
- The following class declaration has errors. Locate as many as you can. class Point {private: int xCoord; int yCoord; public:Point (int x, int y) { xCoord = x; yCoord = y; } // Overloaded + operator void operator+(const &Point Right) { xCoord += right.xCoord; yCoord += right.yCoord; }... Other member functions follow ...};arrow_forwardA(n) ____________ is one instance or variable of a class.arrow_forwardMark the following statements as true or false. The member variables of a class must be of the same type. (1) The member functions of a class must be public. (2) A class can have more than one constructor. (5) A class can have more than one destructor. (5) Both constructors and destructors can have parameters. (5)arrow_forward
- Analysis the following class definition and answer the following question. class Student{ private int id, age; protected float mark; int getAge (int a){ return a ; } protected void setMark (float m){ mark = m; } float result(){ return mark / 2; } } Which is the member variable of the class? a. setMark b. getAge c. result d. private e. agearrow_forward9. A university XYZ would like to have a system that will calculate grade for their students. Thus, you have been assigned to develop the system that requires student name and mark as an input to the system. The system will calculate the grade based on the following table. Grade Mark 0-39.9 40 - 59 60 - 70 71 - 80 81 - 100 F C A The example of the output as follows: : Jung Lee : 75 : Jeongmoon : 85.5 Enter a student name Enter a mark Enter a student name Enter a mark =====- ======= =====-== : Jung Lee : 75.0 Student name Mark Grade : B ===== =======-- ======== : Jeongmoon : 85.5 : A Student name Mark Grade ====arrow_forwardFind the error(s) in the following class definition: public class TestClass private int value1; private int value2; public void TestClass(int num1, int num2) { value1= num1; value2 = num2; }arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning