Monica Vedham

Greenhorn
+ Follow
since Aug 17, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Monica Vedham

How to print the following output with java?
8 years ago
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 :
[email protected]
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 :
[email protected]
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 :[email protected]
Purpose :Commercial
Other details :NIL
Name :Shri
Email :[email protected]
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 :
[email protected]
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 :
[email protected]
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...
8 years ago

Dave Tolls wrote:

Not sure which line is line 63 that is causing the issue, but if it is around here then what name is being entered?

Can you show the output from the app (not just the stack trace)?

I ask because if the name is something like 'John Smith' then Scanner's next() method doesn't do what you expect.





May i know which function of Scanner can help the input like "John Smith"
8 years ago
[Moderation comment] Removed a huge amount of unnecessary quote

The expected result is...
1)Checking Account
2)Saving Account
3)Fixed Account
Enter Account Type
Enter The Account Number
Enter The Customer Name
Enter The Amount
Enter The InterestRate
Hi Jimesh Sharma, currently you are using Saving Account.
Your account number is ACC456753
Your are currently holding amount Rs.65846.0
Rate of interest is 3.0%
8 years ago
I created a code for Inheritance and Encapsulation. It throws error for two testcases and it produces answer for another two. Kindly help me.


The error i get is.....

Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:909)
at java.util.Scanner.next(Scanner.java:1530)
at java.util.Scanner.nextDouble(Scanner.java:2456)
at Main.main(Main.java:63)
8 years ago