Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

2. Outline the business case for a diverse workforce.

Answered: 1 week ago