Array class HWJ16
Lets create a class called HWJ16. In it have an array called studentNames
that will keep track of the names.
Have it initially have 3 names. Use this starter code.
Have the following methods:
public void enterName() - this will allow using the scanner
class for people to enter names
public boolean findStudent(String theName) - this will allow return
true or false of the name is in the array
public void printNames() - this will print out the names in the
array
public void deleteName(String name) - that will delete the name
if its in the list
HW:
Add these methods: - do all of them. Or all 5
if you have a 97 or higher.
public String findLongestName() - this will return the longest
name in the array
public int findShortNames() that will return how many names are
7 letters or less
public void printReverse() -print them out in reverse order
public void insultE() that will print out all names that have an
e and say how ugly they are
public int countLetters() that will return how many letters in
total all of the names have
EC public void fixNames() that will fix every name in the list
so that the first letter of the name is capital and rest not (ie
Jeff Borland not jeff boRland)
EC public boolean noVowels() that will return true any names have
no real vowels (like ty)
|