GSXdan
02-08-2003, 10:37 PM
I am doing an assignment for my c++ class and i keep getting bogus numbers for some of my results. I attached the source if you want to look at it. Here is some info you might need:
"The holiday travel agency is putting together some travel packages for spring break. The rates are intended to last from February of this year through October of this year. They would like a program that will help them calculate the cost of a customer's trip. They have 4 destinations which they will offer at different prices:
Florida rate per day=$75.00 air fare=$195 round trip
Texas $65.00 $250
Cancun $110.00 $375.00
Bahamas $80.00 $300.00
- Since buisness is slow during July and August, there will be a price reduction for reservations during those months. The amount of the discount is based on their destination.
Florida and Cancun: one day free
Texas and Bahamas: 50% off the airfare
-There is also a discount based on how far ahead the reservation is made. This discount is to be applied to the final bill after any other discounts have been deducted.
1-4weeks in advance=no discount
5-6weeks in advance=5% discount
7-9weeks in advance=8% discount
10 or more weeks in advance = 10% discount
input: the user needs to enter 2 dates(reservation date and trip date) in the form of 3 integers. User will enter the number of days they are staying. User will enter F for Florida, T for Texas, C for Cancun, B for Bahamas.
output:
Holiday Travel Agency
Travel Cost Estimate
Reservation Date: xx/xx/xxxx
Trip Date: xx/xx/xxxx
Destination:
Number of days staying:
Cost of trip package: $xxxx.xx
Cost of airfare: $xxxx.xx
July/August discount: $xxxx.xx
Early booking discount:$xxxx.xx
Final Bill: $xxxx.xx
i am getting the right info for cost of dates, destinations, days, and airfare, but i am getting numbers around $40000 for all the other ones. It would be greatly appreciated if someone would look over my code and see what i am doing wrong. If you need any more info, just ask.
Also, how do i format the output so it is in monetary value? I tried doing the setiosflags stuff, but i kept getting error messages.
Thanks a lot ^dan:)
"The holiday travel agency is putting together some travel packages for spring break. The rates are intended to last from February of this year through October of this year. They would like a program that will help them calculate the cost of a customer's trip. They have 4 destinations which they will offer at different prices:
Florida rate per day=$75.00 air fare=$195 round trip
Texas $65.00 $250
Cancun $110.00 $375.00
Bahamas $80.00 $300.00
- Since buisness is slow during July and August, there will be a price reduction for reservations during those months. The amount of the discount is based on their destination.
Florida and Cancun: one day free
Texas and Bahamas: 50% off the airfare
-There is also a discount based on how far ahead the reservation is made. This discount is to be applied to the final bill after any other discounts have been deducted.
1-4weeks in advance=no discount
5-6weeks in advance=5% discount
7-9weeks in advance=8% discount
10 or more weeks in advance = 10% discount
input: the user needs to enter 2 dates(reservation date and trip date) in the form of 3 integers. User will enter the number of days they are staying. User will enter F for Florida, T for Texas, C for Cancun, B for Bahamas.
output:
Holiday Travel Agency
Travel Cost Estimate
Reservation Date: xx/xx/xxxx
Trip Date: xx/xx/xxxx
Destination:
Number of days staying:
Cost of trip package: $xxxx.xx
Cost of airfare: $xxxx.xx
July/August discount: $xxxx.xx
Early booking discount:$xxxx.xx
Final Bill: $xxxx.xx
i am getting the right info for cost of dates, destinations, days, and airfare, but i am getting numbers around $40000 for all the other ones. It would be greatly appreciated if someone would look over my code and see what i am doing wrong. If you need any more info, just ask.
Also, how do i format the output so it is in monetary value? I tried doing the setiosflags stuff, but i kept getting error messages.
Thanks a lot ^dan:)