• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Trying to work out flight discounts in my program  RSS feed

 
Ranch Hand
Posts: 423
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

if there are students and teachers flying to Kingston Jamaica for holiday and...

Flights are $297.67 per person travelling
There is one free teacher’s flight for every 20 students
There is no reduction if a free flight isn’t availed of
Any extra teachers pay full price

now the thing is that if there is no discount nothing must print out...so it only prints out the discount when a free flight is available and deducts it from the grand total at the end

so i was trying to work it out on paper first...

when dont you want reductions to print (ie when isnt there one)

a) when there is less than 20 students
b) when there are no teachers
any others?

here is the code i have written so far,but i just cant get my head around how this would work

 
jon ninpoja
Ranch Hand
Posts: 423
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now this:



produces this:

how many students?100
how many teachers?100
95
end

its minuses 5 from teacher...and 5 free flights is what it is...i know im close
just cant see it.
 
jon ninpoja
Ranch Hand
Posts: 423
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actualFreeFlights = teachers - teachers + freeFlights

think this solved it...but please let me know if im right...or did i miss something

thanks
 
jon ninpoja
Ranch Hand
Posts: 423
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no doesnt work...please help
 
jon ninpoja
Ranch Hand
Posts: 423
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok think i have it now



tell me what you think...
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!