The system seems to be inconsistent to manage the customer details and address details in the same class. So how it would be if we split the class into two classes called the 'Customer' and 'Address' and just by using both of their id to uniquely identify each other by placing the customer id in the address class and address id in the customer class so that we can map many addresses with customer and vice versa?
Let us seek how we can do that. First of all the customer details are collected along with the address id and address details are collected along with customer id so that they can be interrelated easily.
Sample Input and Output 1:
[All text in bold are input and the remaining are output]
Enter the customer details
Enter the id :
1
Enter the name :
Shri
Enter the email :
shri@gmail.com
Enter the purpose :
Commercial
Enter the other customer details :
NIL
Enter address id :
1
Do you want to enter more ?
YES
Enter the id :
1
Enter the name :
Shri
Enter the email :
shri@gmail.com
Enter the purpose :
domestic
Enter the other customer details :
NIL
Enter address id :
2
Do you want to enter more ?
NO
Enter the address details
Enter the address id :
1
Enter the address line :
34,la villa
Enter the city name :
montreal
Enter the zipcode :
123455
Enter the country id:
1
Enter the state name
o hio
Enter the customer id :
1
Do you want to enter more ?
YES
Enter the address id :
2
Enter the address line :
36,kk flats
Enter the city name :
Boston
Enter the zipcode :
789456
Enter the country id:
2
Enter the state name
MA
Enter the customer id :
2
Do you want to enter more ?
NO
Enter the customer id :
1
Address Line :34,la villa
City :montreal
State
hio
Country Code:1
Zipcode :123455
Address Line :36,kk flats
City :Boston
State :MA
Country Code:2
Zipcode :789456
Enter the address id :
1
Name :Shri
Email :shri@gmail.com
Purpose :Commercial
Other details :NIL
Name :Shri
Email :shri@gmail.com
Purpose :domestic
Other details :NIL
Sample Input and Output 2:
[All text in bold are input and the remaining are output]
Enter the customer details
Enter the id :
1
Enter the name :
George
Enter the email :
geo123@gmail.com
Enter the purpose :
Commercial
Enter the other customer details :
NIL
Enter address id :
1
Do you want to enter more ?
YES
Enter the id :
2
Enter the name :
Vincent
Enter the email :
via@gmail.com
Enter the purpose :
domestic
Enter the other customer details :
NIL
Enter address id :
2
Do you want to enter more ?
NO
Enter the address details
Enter the address id :
1
Enter the address line :
34,la villa
Enter the city name :
MAL
Enter the zipcode :
789456
Enter the country id:
2
Enter the state name
MA
Enter the customer id :
1
Do you want to enter more ?
YES
Enter the address id :
2
Enter the address line :
123,viagram villa
Enter the city name :
vietnam city
Enter the zipcode :
123456
Enter the country id:
34
Enter the state name
LA
Enter the customer id :
2
Do you want to enter more ?
NO
Enter the customer id :
3
Customer with id 3 not found !
Address information does not exist for this customer yet !
Enter the address id :
3
Address with id 3 not found !
Customer information does not exist for this customer yet !
Please do help me with code am half way in it... but still i couldn't sort out the problem...int he second half...