For Loop help. PLEASE

Hello all,
I'm trying to figure out this damn problem but don't know where to start.
Any help will be greatly appreciated.

For example: A fund raising committee has agreed to pay you $30.00 per person provided that a minimum of 200 people sign up for a moonlight dinner dance cruise. Anxious for business (and to pay your crew), you agree to lower your price by 50 cents per ticket for EACH additional group of 10 people showing up over the minimum of 200. For example:

210 people Ticket Price is $29.50
220 people Ticket Price is $29.00
230 people Ticket Price is $28.50

Compute the ticket price and profit for each group of passengers starting at 200, 210, 220, 230, 240, 250, ..., 490, 500).

The ship's maximum carrying capacity is 500 passengers.

Your program should allow the following:
1. Ask the user to enter a minimum number of passengers (i.e. 1, 30, 50, 150, 255)
2. Ask the user to enter a maximum number of passengers. The Coast Guard has rated this dinner cruise ship at no more than 500 passengers excluding crew.
3. Ask the user to enter the fixed cost for the cruise (i.e. $2,000, $2,500, $3,550, etc.)
4. Ask the user to enter a discount per ticket per every group of 10 passengers (i.e. 0.10, 0.25, 0.50, etc.)
5. Check that the minimum number of passengers is not greater than the maximum passengers.
6. Check that the maximum is not more than 500 passengers (same for the minimum)
7. Determine the maximum PROFIT, the number of passengers needed to generate that profit, and the ticket price that will generate that profit.
8. User can execute this any number of times. Logic should ask user if they wish to quit or continue. You will be using some sort of loop to repeat the application possibly multiple times.

Algorithms needed:
NP is the Number of Passengers
TP is the Proposed Ticket Price
MP is the Minimum Number of Passengers

Cost of Ticket = TP - (((NP - MP) /10) * .5)
Profit = (NP * Cost of Ticket) - 2500

Since you are "incrementing by 10 passengers", you might want to use some sort of a loop.
Last edited on
The point 8 is an outer loop. It would be in the main() function. Within its body you call a function that processes one cruise.

That function first gets input (points 1-4), validates it (points 5-6), computes and shows result.
So it's a function inside a function?

So it's like:

1. Main () function
a. Point 8?
2. (let's say) Void function
a. Here I should use point 1-7?
CS14? Noticed both your posts lol, any luck?
Topic archived. No new replies allowed.