Skip to content
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
34 changes: 34 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title> Week 1 Project </title>
<link rel="stylesheet" type="text/css" href="style.css" >
<script src="pairs.js"> </script>

</head>

<body style="background-color:#96BFD1;">
<h1 align="center"> Ahmed's Website </h1>
<div class="row">
<div class="column" style="background-color:#69DCCC;">
<h2 align="center"> Random pair generator </h2>
<button type="button" onclick="groups(2)"> random pairs </button>
<button type="button" onclick="groups(3)"> Groups of three </button>
<p id="show"> </p>
</div>
<div class="column" style="background-color:#69accc;">
<h2 align="center"> About Me </h2>
<p align="center">
<a href="slp.jpeg">
<img src="lin.png" align="middle"
</img>
</a>
</p>
</div>
<div class="column" style="background-color:#69DCCC;">
<h2 align="center"> ConstructorLabs Feed </h2>
<a class="twitter-timeline" href="https://twitter.com/ConstructorLabs?ref_src=twsrc%5Etfw">Tweets by ConstructorLabs</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
</div>
</body>
</html>
Binary file added lin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions pairs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@


function groups(size) {
let students = ["Ollie", "Ahmed", "Jose", "Julius", "James", "Alex",
"Edem", "Ethan", "Harry", "Michael", "Ralph", "Phoebe", "Hamza", "Sheila",
"Matt", "Rafal"];
let pairs = [];
let temp = 0;
let i=0
while (i < students.length-1) {
temp = Math.floor(Math.random() * students.length);
pairs.push(students[temp]);
students.splice(temp, 1);
}
pairs.push(students[0]);
i=0
let output = "";
if (size == 2) {
for (let i2 = 0; i2 < pairs.length; i2+=2) {
i++;
output += `Pair ${i} is ${pairs[i2]} and ${pairs[i2+1]} `;
output += " <br> ";
}
}
if (size === 3) {
for (let i2 = 0; i2 < pairs.length-1; i2+=3) {
i++;
output += `Group ${i} is ${pairs[i2]}, ${pairs[i2+1]} and ${pairs[i2+2]}`;
output+= " <br> "
}
let randGroup = Math.floor((Math.random() * 5) + 1);
output += `And ${pairs[15]} is in Group ${randGroup}.`;
}

document.getElementById('show').innerHTML=output;


}
Binary file added slp.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.column{
float: left;
width: 30%;
padding: 10px;
}
.row:after {
content: "";
display: table;
clear: both;
}