EIMACS lab 27.1, .2, lab 28 (all) help??? 10 PTS :))?
-
The PhoneExtension class (defined below) associates the names of people at a business with their phone extensions. In the following program, an array — extensions — of PhoneExtension objects is set up and a static find method is proposed. This is designed to input a name or a 3-digit extension number (both in the form of a String) and return a matching PhoneExtension object from the extensions array. If no such object exists, the find method returns null. In the code area provided below, complete the definition for find. Even though it's not part of the Advanced Placement Java subset, you will need to make use of the toLowerCase method of the String class when comparing the argument to the find method with the names stored in PhoneExtension objects. You want a match to be recognized whenever the argument and one of the stored names differ only in the case of the letters of which they are comprised. (For example, "PETER" and "Peter" should match, but "Peter" and "Pete" should not.) public class PhoneExtension { String myName, myExtension; public PhoneExtension( String name, String extension ) { myName = name; myExtension = extension; } public String getExtension() { return myExtension; } public String getName() { return myName; } public String toString() { return myName + " [" + myExtension + "]"; } } public class MainClass { public static PhoneExtension[] extensions = new PhoneExtension[] { new PhoneExtension( "Janice", "464" ), new PhoneExtension( "Peter", "760" ), new PhoneExtension( "Nicholas", "762" ), new PhoneExtension( "Michael", "465" ), new PhoneExtension( "Ryan", "564" ), new PhoneExtension( "Pamela", "467" ), new PhoneExtension( "Christine", "763" ) }; public static PhoneExtension find( String t ) { // Enter your definition here } In the following program, a new static method, updateExtension, is proposed. This takes two inputs, a name and a new extension number, and replaces the PhoneExtension entry in the extensions array that matches the given name by a new PhoneExtension that has the same, original name and the new extension number. If the name argument does not match the name in an existing PhoneExtension entry, then the updateExtension method does nothing. Complete the definition for updateExtension. (To help you test your definition, a printDirectory method is provided.) public class MainClass { public static PhoneExtension[] extensions = new PhoneExtension[] { new PhoneExtension( "Janice", "464" ), new PhoneExtension( "Peter", "760" ), new PhoneExtension( "Nicholas", "762" ), new PhoneExtension( "Michael", "465" ), new PhoneExtension( "Ryan", "564" ), new PhoneExtension( "Pamela", "467" ), new PhoneExtension( "Christine", "763" ) }; public static void printDirectory() { for ( PhoneExtension ext : extensions ) System.out.println( ext ); } public static void updateExtension( String name, String extension ) { // Enter your definition here } i wrote codes but they dont work :( for (PhoneExtension ext : extensions) { if (ext.GetName().toLowerCase()==t.toLowerC… || ext.getExtension().toLowerCase()==t.toLo… { return ext; } } for (PhoneExtension ext : extensions) { if (ext.GetName().toLowerCase()==name.toLow… ) { ext.myExtension=extension; } } please help any help is appreciated, helping to correct code etc :D THANKS SOO MUCH
-
Answer:
OK. This will take bit of time. I'll email you once I'mdone with the code.
kiki at Yahoo! Answers Visit the source
Related Q & A:
- How do I get experience in my field if people only want to hire experienced professionals? 10 pts?Best solution by Yahoo! Answers
- Is there any way to connect USB in computers to Playstation 1/2/3's controller?Best solution by Yahoo! Answers
- Should I upgrade to OS 3.1.2?Best solution by answers.yahoo.com
- How to make new myspace private 10 pts?Best solution by Yahoo! Answers
- How do you multiple 1 2/3 by 3 1/8?Best solution by themathpage.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.