So I have a program that asks the user to input their information and select services by entering 1 2 3 or etc. and it stores it as an array. This program also stores services it offers as a 2d array with column one as the service name and column two as the cost of service.
I would like to be able to grab a customer from the array and see which services the customer chose then calculate the total cost of the services he chose.
Here is my very rough pseudocode:
Say I want customer 2's info
He chooses service 1 and 3
He chose serviceEntry[1][0] and serviceEntry[3][0]
Get serviceEntry[1][1] + serviceEntry[3][1] and store as sum
return String serviceEntry[1 -1][0] + serviceEntry[3 - 1][0] will cost the variable sum.
My problem is I have an unknown service array length and when the customer enters 1 2 3 or etc, its stored as a string. How do I get those individual numbers and place it as an index in my 2d array. Such as if I had 10 services, how would I get the integer 10 instead of 1 and 0.
Thanks for any help and I'm sorry if the way I described the problem is confusing.
I would like to be able to grab a customer from the array and see which services the customer chose then calculate the total cost of the services he chose.
Here is my very rough pseudocode:
Say I want customer 2's info
He chooses service 1 and 3
He chose serviceEntry[1][0] and serviceEntry[3][0]
Get serviceEntry[1][1] + serviceEntry[3][1] and store as sum
return String serviceEntry[1 -1][0] + serviceEntry[3 - 1][0] will cost the variable sum.
My problem is I have an unknown service array length and when the customer enters 1 2 3 or etc, its stored as a string. How do I get those individual numbers and place it as an index in my 2d array. Such as if I had 10 services, how would I get the integer 10 instead of 1 and 0.
Thanks for any help and I'm sorry if the way I described the problem is confusing.
Comment