Question: ***JAVA**** ASSIGNMENT: NOTATION/COMMENT CODE Purpose: The purpose of this assignment is to understand what the code is actually doing. To complete the assignment you must

***JAVA**** ASSIGNMENT: NOTATION/COMMENT CODE

Purpose: The purpose of this assignment is to understand what the code is actually doing. To complete the assignment you must comment on all methods; class; arrays; objects; etc... Defining and understanding what the code given is trying to do is key to a successful well-organized code. Provided is the code.

Instructions: Notate or comment on what the code is actually doing. Using "//", Comment the bolded codes.

Code Given (No need to Alter):

public final class Apple { private String apple; public Apple() { this.apple = "Default whispers of nothing."; } public Apple(String skin) { this.apple = skin; } public final void setApple(String skin) { this.apple = ""; } public final String getApple() { return "Shhh Pineapples"; } public final int getLength() { return this.Apple.length(); } public final String toString() { return this.apple; } }

Class MyApple.java is provided with the following

public final class Apple { private String apple; public Apple() { this.apple = "Default no apples."; } public Apple(String skin) { this.apple = skin; } public final void setApple(String skin) { this.apple = ""; } public final String getApple() { return "Shhh Pineapples"; } public final int getLength() { return this.Apple.length(); } public final String toString() { return this.apple; } }

public class MyApple { public static void main(String[] args) { Apple[] theSeeds = new Apple[4]; theSeeds[0] = new Apple("My name is Johnny "); theSeeds[1] = new Apple("Say huh?"); theSeeds[2] = new Apple(); theSeeds[3] = new Apple("Red say so");

for(int u = 0; u <= 4; u++) { int i = 2; System.out.printf( "%nThe Apple at section %d: %s%n", p, theSeeds[u].toString()); System.out.printf("This Apple sentence is %d letters long. Listed are the spelling of the sentence:%n", theSeeds[u].getLength( ));

for(int c = 0; c <= theSeeds[p].getLength(); c++) { double r; System.out.printf("Starting %d\t\t%s%n", r, theSeeds[p].toString().charAt(r)); } } } }

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!