Question: File 1 : { private String word; public StringStuff ( String word ) { this.word = word; } public String getFirstLastLetters ( ) { return
File :
private String word;
public StringStuffString word
this.word word;
public String getFirstLastLetters
return word.substring word.substringwordlength;
public char getMiddleLetter
int middlePosition word.length;
if wordlength
return word.charAtmiddlePosition;
else
return word.charAtmiddlePosition ;
public int diffInASCII String letter
return ;
public boolean sameFirstLastLetters
if wordlength
return false;
else
return word.charAt word.charAtwordlength;
public String toString
return word;
File :
import java.util.Scanner;
public class StringRunner
public static void main String args
Scanner keyboard new ScannerSystemin;
System.out.printEnter a word :: ;
String word keyboard.nextLine;
StringStuff myWord new StringStuffword;
System.out.printlnHas first last letters :: myWord.getFirstLastLetters;
System.out.printlnHas middle letter :: myWord.getMiddleLetter;
System.out.printlnHas same first and last letters :: myWord.sameFirstLastLetters;
How do i get the ASCII method right?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
