Question

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;

}

0 0
Add a comment Improve this question
Answer #1

The answer is Perfect:

Please find the another version

public double getAmount ()

   {

   return expenseAmount;

   }

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Can you please check this code and see if its correct An accessor method named getAmount...
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
  • 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

  • Java code please. Please help * 95: Write a public class named TollInts with the following....

    Java code please. Please help * 95: Write a public class named TollInts with the following. * -A public constructor that takes 2 doubles as inputs. * -A public method named compute that takes no parameters and returns the the tangent of the * first constructor input subtracted by the the square root of the second constructor input * as a double. You will need to store the constructor input in instance variables to be able * to access them...

  • java This lab is intended to give you practice creating a class with a constructor method,...

    java This lab is intended to give you practice creating a class with a constructor method, accessor methods, mutator methods, equals method , toString method and a equals method. In this lab you need to create two separate classes, one Student class and other Lab10 class. You need to define your instance variables, accessor methods, mutator methods, constructor, toString method and equals method in Student class. You need to create objects in Lab10 class which will have your main method...

  • java With the incredible royalties on your Jukebox-management code, to become a DJ. You realize that you can adap...

    java With the incredible royalties on your Jukebox-management code, to become a DJ. You realize that you can adapt the Jukebox code to create some sophistica software for your new career. Consider the slightly simplified versio As a DJ, you are mainly interested in the BPM (beats per minute) and rating of the songs. you decide to indulge your dream n of the book's Song class below. public class Song private String title private String artist; private int rating private...

  • 6. Code a statement that assigns the value “Test” to a scalar variable named (can not...

    6. Code a statement that assigns the value “Test” to a scalar variable named (can not insert the at sign, but it should be here)Name that’s declared with the varchar data type. 8. A parameter passes a value from the calling program to the stored procedure, unless you code the ______________________________ keyword. 9. Unless a database system supports declarative referential integrity, the only way to enforce referential integrity is to use ______________________________. 10. Code a statement that returns the value...

  • // Client application class and service class Create a NetBeans project named StudentClient following the instructions...

    // Client application class and service class Create a NetBeans project named StudentClient following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. Add a class named Student to the StudentClient project following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. After you have created your NetBeans Project your application class StudentC lient should contain the following executable code: package studentclient; public class...

  • put everything together in an object-oriented manner! create a class named PositiveNumberStatistics that has the following:...

    put everything together in an object-oriented manner! create a class named PositiveNumberStatistics that has the following: A private double 1D array instance variable named numbers. A constructor that takes one parameter, a 1D double array. The constructor should throw an IllegalArgumentException with the message "Array length of zero" if the parameter has a length of 0. If the exception is not thrown, the constructor should create the numbers array and copy every element from the parameter into the numbers instance...

  • Can you tell me if this code is correct A shoppingCart class with the following instance...

    Can you tell me if this code is correct A shoppingCart class with the following instance variables: * cardNumber - default value "unknown" * securityCode - default value "000" Here is my answer for the following above public ShoppingCart() { this.cardNumber = "unknown"; this.securityCode = 000; }

  • java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code...

    java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code I'll tell you what to do. Use other code as a guide.  Start with a for loop with a start of int i = 0  Set the ending point of when i is less than the length of the arr array.  Set the incrementation to increase i by 1 using the unary operator ++.  Within the loop set the arr...

  • Programming 5_1: Create a Java class named <YourName>5_1 In this class create a main method...

    Programming 5_1: Create a Java class named <YourName>5_1 In this class create a main method, but for now leave it empty. Then write a Java method getAverage which takes an array of integers as it’s argument. The method calculate the average of all the elements in the array, and returns that average. The method should work for an array of integers of any length greater than or equal to one. The method signature is shown below: public static double getAverage(...

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