Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/merttalug/flightticketprice
A program that calculates the ticket prices that users have to pay by taking as input the distance they want to fly, their age, and whether they prefer a one-way or round-trip ticket.
https://github.com/merttalug/flightticketprice
calculator java kodluyoruz patika-dev
Last synced: about 2 hours ago
JSON representation
A program that calculates the ticket prices that users have to pay by taking as input the distance they want to fly, their age, and whether they prefer a one-way or round-trip ticket.
- Host: GitHub
- URL: https://github.com/merttalug/flightticketprice
- Owner: merttalug
- License: mit
- Created: 2022-03-04T18:25:10.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-05T11:42:46.000Z (almost 3 years ago)
- Last Synced: 2024-11-05T11:32:44.832Z (about 2 months ago)
- Topics: calculator, java, kodluyoruz, patika-dev
- Language: Java
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FlightTicketPrice
A program that calculates the ticket prices that users have to pay by taking as input the distance they want to fly, their age, and whether they prefer a one-way or round-trip ticket.
The program first calculates the initial price by multiplying the distance passengers want to fly by $0.1 per kilometer.
> distance(km) * $0.1(per km) = Initial Price`initPrice= dist*0.1;`
## Discounts
In the scope this program, passengers who want to buy tickets are given some discounts on the initial price. Age and ticket type are these discounts.### Age Discount
- 50% discount is applies to under 12 years old.
- 10% discount is applied for 12-24 year olds.
- 30% discount is applied for 65 years and older.` if (age<12){
secPrice=initPrice*0.5; `### Ticket Type Discount
Depending on the passengers' one-way or round-trip flight ticket preferences, a discount is applied over the age discounted price.
- 20% discount is applied to those who prefer a round trip ticket.
- Discounts are not applied to those who prefer a one-way ticket.` if (type==2){
finalPrice=secPrice*0.8;
} `