Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with Assignment in JAVA For this programming assignment, you are to cr

ID: 3767282 • Letter: N

Question

Need help with Assignment in JAVA

For this programming assignment, you are to create a sorted contact list in a tree. The input accepted into the program should be as follows:

Last name, first name
Phone number
Address

The information should be sorted alphabetically according to the last name and then first name (if you have two names with the same last name, they would need to be sorted according to their first name). This means the "key" in the node should be lastName_firstName.

When you create the node, there should be the data attached on their phone number and address

Contact Information:

Trepe, Quistis
(310)-555-2432
Greenfields, MN

Fischer, Max
(988)-555-5457
Mount Rushmore, WA

Williams, Ash
(308)-555-1237
Darkplains, CA

Teavee, Mike
(729)-555-1237
Denver, CO

West, Billy
(439)-555-2135
Future, NY

Holm, Anders
(833)-555-4592
Telamericorp, RI

Naughton, Cal
(101)-555-2923
Taladega, CA

Brooks, Pepper
(545)-555-0002
Bateman, IA

Smecker, Paul
(573)-555-9112
Boondock, PA

Smith, John
(555)-555-5555
Greenville, OK

Connor, John
(763)-555-1007
Fremont, CA

Venture, Dean
(935)-555-27676
Ventura, CA

Smith, Jane
(555)-555-5555
Greenville, OK

Bauer, Jack
(800)-555-317
Loves Park, IL

Black, Joe
(729)-555-9827
Appleton, WI

Siren, Lilith
(539)-555-8834
Pandora, NM

Adams, Natalie
(247)-555-1056
Toronto, CA

Tannen, Biff
(677)-555-3058
Hill Valley, MN

Explanation / Answer

#include //Always use meaningful names for types typedef unsigned char boolean; #define True 't' #define FALSE (!True) //this is a really neat trick for swapping values efficiently void swap(long* a,long *b) { *a=*a^*b;*b=*b^*a;*a=*a^*b; } //Here's a readability improvement #define until(condition) while(!(condition)) int main(int n, char*args[]){ double *d; int i; char input[5]; //should be long enough for most doubles. boolean sorted = FALSE; //In C, you need to specify the array size beforehand, so ask printf("Please enter the length of the array "); gets(input); //scan the input string and convert to a value sscanf(input,"%s",&input[0]); n=(long)atol(input); //allocate space, make sure you get the order of arguments right. d = calloc(sizeof(double),n); //Get and sort the array until (sorted) { for (i=0;i