BestFare Calculator making it more advanced

I completed the task, thats not what i need help with

I need help if i want the program to take more variables in consideration.

Im stuck mentally.

  1. I want the program to stop users from buying tickets for less than one day and less than one ride.

  2. I want the program to give the best price for the amount of days by summaries the numOfDays into months, weeks and days. 38 days should become one 30-day unlimited, one 7-day unlimited and one day. After doing this i want the program to return a string with the information.
    “You are buying tickets for x numOfDays, the best option for you would be x,x,x” where the program only prints the valid field. Not 0 months, 0 weeks.

  3. I want the program to give the best option for customer who doesnt know the amount of rides they are taking. I guess this will be sorted in 2.

Im not sure if i cant solved 2 and 3 with if statements, for statements, arrays and for each statements or a mix or those.

Help would be appreciated

Hi!,

  1. I want the program to stop users from buying tickets for less than one day and less than one ride.
  1. You can write a conditional that if the input is lower than 1, they are prompted for something else, or simply not even give the choice for such an input.

  2. You need a method that parses the int days into an array of ints [months, weeks, days]. As for the print statement you can use string formatting.

  3. This one is a little vaguer. And therefore potentially open ended. Are we talking about a customer that doesn’t know anything period or someone who has a range of rides they may take (more difficult calculation).

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.