Question: 5. Write the statement that would assign your name to the memory location declared above. _____________________________________________________________________________ 6. What was the name of the method in

5. Write the statement that would assign your name to the memory location declared above. _____________________________________________________________________________ 6. What was the name of the method in the Ball class that displayed information about the ball? _ _____________________________________________________________________________ 7. Write the Java command that would display the current owner of the credit card object - whomever it was at any time. (Writing the method is not necessary here just the display statement.) It might look like this with the blank filled with the current owners name: _____________________________________________________________________________ 8. Explain the difference between an accessor and a mutator method. Give an example of each from the Student class (lab-classes project). _________________________________________ _____________________________________________________________________________

code

/** * Write a description of class ball here. * * @author (your name) * @version (a version number or a date) */ public class ball { // instance variables - replace the example below with your own private String color; private int diameter;

/** * Constructor for objects of class ball */ public ball() { // initialise instance variables color = "red"; diameter = 10; }

/** * An example of a method - replace this comment with your own * * @param y a sample parameter for a method * @return the sum of x and y */ public String getColor(){ return color; } public int getDiameter(){ return diameter; } public void setYellowColor(){ color = "yellow"; } public void setOrangeColor(){ color = "orange"; } public void setBallColor(String setColor){ color = "setColor"; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!