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

Isabella_seats #117

Open
wants to merge 1 commit 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
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<link rel="stylesheet" href="style.css">
</head>
<body>
<input class="starter" id="input" placeholder="input"/>
<h2>Buy plane ticket here</h2>
<input class="starter" id="input" placeholder="Type to purchase seat"/>
<button class="button">Buy now</button>
<h2>output:</h2>
<p class="starter" id="output"></p>
<script>
Expand All @@ -20,4 +22,4 @@ <h2>output:</h2>
</script>
<script src="script.js"></script>
</body>
</html>
</html>
34 changes: 29 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
console.log("hello script js");
let seat = 10; //total no. of seats
let price = 50; //assume price will be compounded

var inputHappened = function(currentInput){
console.log( currentInput );
return "WOW SOMETHING HAPPENED";
};
function inputHappened(currentInput){
console.log(currentInput);
if(currentInput != "") {
if(seat >= 6 && seat <= 9) {
//seats #2–5 cost 3% more compounded
seat--;
price = price * 1.03; //price is used bec amt is compounded
} else if(seat >= 2 && seat <= 5) {
//seats #6–9 is 5% more compounded
seat--;
price = price * 1.05;
} else if(seat > 0 && seat == 1) {
//last seat is 91,000
seat--;
price = 91000;
} else if(seat == 10) {
//first seat is 50;
seat--;
price = 50;
} else {
//notify no more seat left
return "No more seat left";
}
alert(seat + " seat(s) left");
return "Seat selected, the price of your seat is $ " + price + ".";
}
}
30 changes: 24 additions & 6 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
.starter{
font-size:30px;
padding:10px;
display:block;
margin:40px;
border:3px solid blue;
font-size: 20px;
padding: 30px;
display: inline-block;
box-sizing: 60px;
margin: 0px 40px;
border: 2px solid blue;
}

#output{
background-color:pink;
background-color: lightgrey;
margin: 0px 40px;
display: inline-block;
}

.h2 {
margin: 20px 40px;
}
.button {
border: 10 auto;
color: black;
padding: 10px 10px;
text-align: center;
text-decoration: none;
font-size: 14px;
margin: 10px 40px 0px 0px;
transition-duration: 0.4s;
cursor: pointer;
}