Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metilda's Airline Ticket Kiosk #124

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 1 addition & 93 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,2 @@
# seats

![https://media.giphy.com/media/WKJpCXfvBHyla/giphy.gif](https://media.giphy.com/media/WKJpCXfvBHyla/giphy.gif)

Implement a program for a kiosk that sells airline tickets.

### Requirements:

A plane has 10 seats.

When the plane is empty a seat is $50.

For each seat sold the ticket price goes up 5% over the original price of $50.

When a user types anything into the input, consider that seat sold and show the user the price of their seat.

### How to start
Think about what different steps are asked to be implemented in this program.

How can you implement each and add them on top of each other?

How does this task break down into different parts?

A suggested order might be:

- calculate the price of a seat when it never changes. ( it is always $50 )
- add on keeping track of how many seats are left on the plane
- add on the price increase functionality

Remember that each time you complete a part of the assignment, you should make a **commit** in git.

### further
The airline boss requests finer-grained pricing:

For the first half of the seats, the price goes up 3% over the original price of $50.

For the second half it goes up by 5% over the original price of $50.

The last seat is $91,000.

### further
When outputing a message tell the user how many tickets are left before the price bracket goes up.

### further
Change the pricing to increase by 3% and 5% over the *current* price of the ticket. (i.e., each ticket is some percentage more than the last)

### further
Implement a check of the input. Make sure to show the user a message when they type something invalid.

### further
The airline upgraded it's fleet of aircraft. Each plane has 3 cabins, economy, business and first class.

The user can now type in "buy first class" and the kiosk will sell them a first class seat, same for the other cabins.

A plane now has 15 economy seats, 6 business class seats and 4 first class seats.

##### The pricing models have also changed:

##### For economy pricing is the same.

For the first half of the seats, the price goes up 3%.

For the second half it goes up by 5%.

The last seat is $91,000.

##### For business class:

For the first half of the seats, the price goes up 6%.

For the second half it goes up by 10%.

The last seat is $91,000.

##### For first class:

All seats goes up by 15% over the original price of $50.

The last seat is $191,000.

### further
The airline wants to use the entire fleet of aircraft. (Up to now you've only been using one plane)

Flights to KL use the 10 seat plane.

Flights to Bali use the 3 cabin plane.

Let the user type in their destination.

Show them the price of the ticket.

If they then type "buy", sell that ticket.

If they type "cancel", don't sell the ticket.
Code only works on playcode, bug on line 6
23 changes: 9 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
<link rel="stylesheet" href="style.css">
</head>
<body>
<input class="starter" id="input" placeholder="input"/>
<h2>output:</h2>
<p class="starter" id="output"></p>
<script>
document.querySelector('#input').addEventListener('change', function(event){
var currentInput = event.target.value;
var result = inputHappened(currentInput);
display( result );
});
<div id="row1">
<h1>Let's buy some seats!</h1>
<input class="starter" id="input" placeholder="input"/>
<button id="submit">Buy</button>
</div>
<div id="row2">
<h2>output:</h2>
<p class="starter" id="output"></p>
</div>

var display = function( data ){
var output = document.querySelector('#output');
output.innerText = data;
}
</script>
<script src="script.js"></script>
</body>
</html>
Loading