Suppose a
// Declaration of Checkpoint class.
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 regarding the class:
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 CheckPoint 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 15 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Java How To Program (Early Objects)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with Java: Early Objects (6th Edition)
- Java - Calculator Classarrow_forwardNumber 25arrow_forwardAnalysis 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; } } What is the access specifier of the result in the above code? a. No access specifier b. private c. float d. public e. voidarrow_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_forwardDesign a class that implements the basic properties of a die. Consider the definition of the following class die.(Beginner) class die { public: die(); //Default constructor //Sets the default number rolled by a die to 1 void roll(); //Function to roll a die. //This function uses a random number generator to randomly //generate a number between 1 and 6, and stores the number //in the instance variable num. int getNum() const; //Function to return the number on the top face of the die. //Returns the value of the instance variable num. private: int num; }; a) Write the definitions of the functions to implement the operations for the class die. b) Write a program that uses the class die to roll 10 dice. (Use an array of size 10 to implement 10 dice.) The program prompts the user to enter the desired sum and the number of times the dice are to be rolled. The program outputs the number of times the desired sum was rolled. Test run your program to roll the 10 dice 10000 times with the desired…arrow_forwardConsider the following class definition: (8) class base { public: void setXYZ(int a, int b, int c) ; voidsetX ( int a ) ; int getX ()const{returnx; } void setY ( int b ); intgetY()const{returny; } int mystryNum () {return ( x &*#x00A0;y - z &*#x00A0;z) ;} void print () const; base () } base(int a, int b, int c); protected: void setz ( int c) { z= c; } void secret(); int z= 0; private: int x= 0; int y = 0; }; a. Which member functions of the class base are protected? b. Which member functions of the class base are inline? c. Write the statements that derive the class myclass from class base as a public inheritance. d. Determine which members of class base are private, protected, and public in class myclass.arrow_forward
- JAVA Language Caesar Shift Question: Modify the Caesar class so that it will allow various sized shifts to be used, instead of just a shift of size 3. (Hint: Use an instance variable in the Caesar class to represent the shift, add a constructor to set it, and change the encode method to use it.) import java.util.*; public class TestCipher { public static void main(String[] args) { int shift = 7; Caesar caesar = new Caesar(); String text = "hello world"; String encryptTxt = caesar.encrypt(text); System.out.println(text + " encrypted with shift " + shift + " is " + encryptTxt); } } abstract class Cipher { public String encrypt(String s) { StringBuffer result = new StringBuffer(""); // Use a StringBuffer StringTokenizer words = new StringTokenizer(s); // Break s into its words while (words.hasMoreTokens()) { // For each word in s…arrow_forwardDetermine if this statement is true or false Take the following method, which is defined in some class: class SomeClass: SomeBaseClass{ private int override MyMethod() { //do something.... } } This is an example of run time polymorphism, as MyMethod is being redefined in the child class by the override keyword.arrow_forwardjava code, pls use more // commentsarrow_forward
- class GradedActivity { private: double score; public: GradedActivity() { score = 0.0; } GradedActivity(double s) { score = s; } void setScore(double s) { score = s; } double getScore() { return score; } char getLetterGrade() const; }; Implement the GradedActivity class above. In this C++ assignment, create a new class Assignment which is derived from GradedActivity. It should have three private member ints for 3 different parts of an assignment score: functionality (max 50 points), efficiency (max 25 points), and style (max 25 points). Create member function set() in Assignment which takes three parameter ints and sets the member variables. It should also set its score member, which is inherited from GradedActivity, using the setScore() function, to functionality + efficiency + style. Signature: void Assignment::set(int, int, int) Create a main program which instantiates an Assignment, asks the user…arrow_forwardAPEX Test Class - Salesforce Please Desgin the Apex Test Class to solve the below problem public with sharing class MyFirstClass{ // Variable to store the values to perform the multiplication logic static Integer a = 5; static Integer b= 9; public static Integer productOfTwoNumbers; public static void multipicationOfTwoNumber() { //Product of the two Numbers productOfTwoNumbers = a * b; }arrow_forward/** NoParking models a No Parking sign */ public class NoParking { //-----------Start below here. To do: approximate lines of code = 15 // 1. Write the class so that it works as expected with the unit tester. private String startTime; private String endTime; /** Constructs a NoParking object with a default time */ public NoParking(){ startTime = "0:00"; endTime = "23:59"; } /** Sets the start time @param the start time */ public void setStartTime(String start){ startTime = start; } /** Sets the end time @param the end time */ public void setEndTime(String end){ endTime = end; } /** Reverses the times */ /** Returns the string for no parking @return the string for no parking */ } //-----------------End here. Please do not remove this…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning