In this segment of the ticket booking system, I've implemented the functionality to retrieve and display ticket prices based on the selected destination city.
first i created ticketPrices: An integer array corresponding to the ticket prices for each city in indianCities
Function Implementation:
Developed a function named getPriceForCity
-> The function iterates through the indianCities array, comparing the input city with each entry. If a match is found, it returns
the corresponding price from the ticketPrices array. If the city is not found, it returns -1 to indicate an error.
@vasu-CE mention the issue in comment always something like closes #issue-number or fixes #issue-number, which will automatically close the issue ex: fixes #40 : display price based on destination
In this segment of the ticket booking system, I've implemented the functionality to retrieve and display ticket prices based on the selected destination city.
first i created ticketPrices: An integer array corresponding to the ticket prices for each city in indianCities
Function Implementation: Developed a function named getPriceForCity -> The function iterates through the indianCities array, comparing the input city with each entry. If a match is found, it returns the corresponding price from the ticketPrices array. If the city is not found, it returns -1 to indicate an error.