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 Transcribed image text
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...

  • IN JAVA PLEASE Lab 28.1 Add a class named Purchase with: an instance (String) variable for...

    IN JAVA PLEASE Lab 28.1 Add a class named Purchase with: an instance (String) variable for the customer's name an instance (double) variable for the customer's balance a member method public String toString() that returns the object's instance variable data as a single String; e.g., Cathy has a balance of $100.00 Lab 28.2 Add a main class named Store; . Then, add code that: declares and creates an ArrayList of Purchase objects named purchases (make sure to add import java.util.ArrayList...

  • 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...

  • Define an interface named Shape with a single method named area that calculates the area of...

    Define an interface named Shape with a single method named area that calculates the area of the geometric shape:        public double area(); Next, define a class named Circle that implements Shape. The Circle class should have an instance variable for the radius, a constructor that sets the radius, an accessor and a mutator method for the radius, and an implementation of the area method. Define another class named Rectangle that implements Shape. The Rectangle class should have instance variables...

  • JAVA PROG HW Problem 1 1. In the src −→ edu.neiu.p2 directory, create a package named...

    JAVA PROG HW Problem 1 1. In the src −→ edu.neiu.p2 directory, create a package named problem1. 2. Create a Java class named StringParser with the following: ApublicstaticmethodnamedfindIntegerthattakesaStringandtwocharvariables as parameters (in that order) and does not return anything. The method should find and print the integer value that is located in between the two characters. You can assume that the second char parameter will always follow the firstchar parameter. However, you cannot assume that the parameters will be different from...

  • 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; }

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
Active Questions
ADVERTISEMENT