Question

To return the value of an instance variable named v from a get property, you code:...

To return the value of an instance variable named v from a get property, you code:

return v;

v = value;

return value;

break;

A read-only property consists of just:

a get method

a set method

a set accessor

a get accessor

To begin the declaration for a constructor, you code the public keyword followed by:

the name of the property

the data type of the class

the name of the class

the arguments

0 0
Add a comment Improve this question Transcribed image text
Answer #1


1.To return the value of an instance variable named v from a get property, you code:
A. return v;
B. v = value;
C. return value;
D. break;

Reason:
Given variable name is V so it can be return as below:
Int main()
{
int v;
//sampe code;
return v;
}


2.A read-only property consists of just:
A. a get method
B. a set method
C. a set accessor
D. a get accessor

Reason:
Get accessor is nothing but it is the get procedure where it is used to return a value.Set accessor is nothing but it is the set procedure where it is used to assign the new value.so that read-only property consists of just get accessor.

3. To begin the declaration for a constructor, you code the public keyword followed by:
A.The name of the property
B.The data type of the class
C.The name of the class
D.The arguments

Reason:

Constructor is nothing but it is the special member of a class that initializes the class object where name of the constructor is same as class name and which does not have return type. so To begin the declaration for a constructor, you code the public keyword followed by the name of the class.So option C is correct.

Add a comment
Know the answer?
Add Answer to:
To return the value of an instance variable named v from a get property, you code:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • use java follow my code: public class q1 {    // Instance Variables    int currentFloor;...

    use java follow my code: public class q1 {    // Instance Variables    int currentFloor;    double maximumWeight;    int topFloor;       // Constructor Declaration of Class    public q1 (int currentFloor, double maximumWeight, int topFloor)    {    this.currentFloor = currentFloor;    this.maximumWeight = maximumWeight;    this.topFloor = topFloor;    }       // Property to get value of currentFloor instance variable    public int getCurrentFloor()    {    return currentFloor;    }       // Property...

  • Python Write the definition of a class Counter containing: An instance variable named counter of type...

    Python Write the definition of a class Counter containing: An instance variable named counter of type int An instance variable named limit of type int. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit A method named increment. It does not take parameters or return a value; if the instance variable counter is less than limit, increment just adds one to the instance variable counter. A method named decrement....

  • 1a. Create a class named Inventory - Separate declaration from implementation (i.e. Header and CPP files)...

    1a. Create a class named Inventory - Separate declaration from implementation (i.e. Header and CPP files) 1b. Add the following private member variables - a int variable named itemNumber - an int variable named quantity - a double variable named cost - a double variable named totalCost. Total cost is defined as quantity X cost. - updateTotalCost() which takes no arguments and sets the values of the variable totalCost. 1c. Add the following public functions: - Accessor and Mutators for...

  • Read through the code of the class Player, noting it has two instance variables, name and rank, which are of type String and three further instance variables won, drew and lost which are of type int....

    Read through the code of the class Player, noting it has two instance variables, name and rank, which are of type String and three further instance variables won, drew and lost which are of type int. There is also an attribute of the class, points, which does not have a corresponding instance variable. Also note the constructor and methods of the class and what they do. TournamentAdmin class code: public class RankAdmin {    /**     * Constructor for objects of class...

  • Java - Object Oriented Programming Declare a class named Customer that has two private fields? Write...

    Java - Object Oriented Programming Declare a class named Customer that has two private fields? Write a set method to make sure that if age > 125 years or less than 0 then it is set to 0 (default value) What does it indicate when declaring a class's instance variables with private access modifier? What is the role of a constructor? The data part of by an object's instance variables is known as? Do all methods have to always return...

  • Define a class named Payment that contains an instance variable "paymentAmount" (non-static member variable) of type...

    Define a class named Payment that contains an instance variable "paymentAmount" (non-static member variable) of type double that stores the amount of the payment and appropriate accessor (getPaymentAmount() ) and mutator methods. Also create a method named paymentDetails that outputs an English sentence to describe the amount of the payment. Override toString() method to call the paymentDetails() method to print the contents of payment amount and any other details not included in paymentDetails(). Define a class named CashPayment that is...

  • Can you please check this code and see if its correct An accessor method named getAmount...

    Can you please check this code and see if its correct An accessor method named getAmount that has no explicit parameters and returns the double value of the instance variable expenseAmount.   Here is my code below. public double getAmount () {     return this.expenseAmount; }

  • In a project named 'DogApplication', create a class called 'Dog' 1. declare two instance variables in...

    In a project named 'DogApplication', create a class called 'Dog' 1. declare two instance variables in 'Dog' : name (String type) age (int type) 2. declare the constructor for the 'Dog' class that takes two input parameters and uses these input parameters to initialize the instance variables 3. create another class called 'Driver' and inside the main method, declare two variables of type 'Dog' and call them 'myDog' and 'yourDog', then assign two variables to two instance of 'Dog' with...

  • Using C# Create an application class named LetterDemo that instantiates objects of two classes named Letter...

    Using C# Create an application class named LetterDemo that instantiates objects of two classes named Letter and CertifiedLetter and that demonstrates all their methods. The classes are used by a company to keep track of letters they mail to clients. The Letter class includes auto-implemented properties for the Name of the recipient and the Date mailed (stored as strings). Next, include a ToString() method that overrides the Object class’s ToString() method and returns a string that contains the name of...

  • Create a class named Module2. You should submit your source code file (Module2.java). The Module2 class...

    Create a class named Module2. You should submit your source code file (Module2.java). The Module2 class should contain the following data fields and methods (note that all data and methods are for objects unless specified as being for the entire class) Data fields: A String object named firstName A String object named middleName A String object name lastName Methods: A Module2 constructor method that accepts no parameters and initializes the data fields from 1) to empty Strings (e.g., firstName =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT