Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 2 additions & 1 deletion 3 .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

package-lock.json
.DS_Store

2 changes: 1 addition & 1 deletion 2 arrays/studio/string-modification.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ console.log(`Previously, the string was ${str}. Now it is ${newString}`);
let userInput = input.question("How many letters will be rearrange?");

//3) Add validation to your code to deal with user inputs that are longer than the word. In such cases, default to moving 3 characters. Also, the template literal should note the error.
if ( userInput === "three" || 3) {
if ( userInput == "three") {
console.log("Correct!");
} else {
console.log("Your answer was longer than the correct response");
Expand Down
45 changes: 42 additions & 3 deletions 45 classes/exercises/ClassExercises.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
// Define your Book class here:

class Book {
constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
this.title = title;
this.author = author;
this.copyright = copyright;
this.isbn = isbn;
this.pages = pages;
this.timesCheckedOut = timesCheckedOut;
this.discarded = discarded;
}
checkout(uses=1) {
this.timesCheckedOut += uses;
}
}

// Define your Manual and Novel classes here:
class Manual extends Book {
constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
super(title, author, copyright, isbn, pages, timesCheckedOut, discarded);
}

dispose(currentYear){
if (currentYear-this.copyright > 5) {
this.discarded = 'Yes';
}
}
}

// Declare the objects for exercises 2 and 3 here:
class Novel extends Book {
constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
super(title, author, copyright, isbn, pages, timesCheckedOut, discarded);
}

dispose(){
if(this.timesCheckedOut > 100) {
this.discarded = 'Yes';
}
}
}


// Code exercises 4 & 5 here:
// Declare the objects for exercises 2 and 3 here:
let aNovel = new Book ('Pride and Prejudice','Jane Austen',1813,1111111111111,432,32,'No');
let aManual = new Manual ('Top Secret Shuttle Building Manual','Redacted',2013,0o0,1147,1,'No')

// Code exercises 4 & 5 here:
aNovel.checkout(5);
console.log(aNovel.discarded);
43 changes: 43 additions & 0 deletions 43 classes/studio/ClassStudio.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
//Declare a class called CrewCandidate with a constructor that takes three parameters—name, mass, and scores. Note that scores will be an array of test results.
class CrewCandidate {
constructor(name, mass, score) {
this.name = name;
this.mass = mass;
this.score = score;
}

addScore(newScore) {
this.scores.push(newScore);
}

averageScore() {
if (this.scores.length === 0) {
return 0;
}

const totalScore = this.scores.reduce((total, score) => total + score, 0);
return totalScore / this.scores.length;
}

isAdmissible(minimumAverageScore) {
const avg = this.averageScore();
return avg >= minimumAverageScore;
}

status() {
const avg = this.averageScore();
if (avg >= 90) {
return "Accepted";
} else if (avg >= 80) {
return "Reserve";
} else if (avg >= 70) {
return "Probationary";
} else {
return "Rejected";
}
}
}

let animal1 = new CrewCandidate ("Bubba Bear", 135, [88, 85, 90]);
console.log(animal1);
let animal2 = new CrewCandidate ("Merry Maltese", 1.5, [93, 88, 97]);
console.log(animal2);
let animal3 = new CrewCandidate ("Glad Gator", 225, [75, 78, 62]);
console.log(animal3);

//Add methods for adding scores, averaging scores and determining candidate status as described in the studio activity.

Expand Down
53 changes: 53 additions & 0 deletions 53 css/exercises/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<style>
body {
background-color: yellow;
}

h1 {
font-size: 36px;
text-align: center;
}

h2 {
text-align: center;
}

ol {
text-align: center;
}

p {
color: green;
}

#cool-text {
color: blueviolet;
}

#list-color {
color: blue;
}

</style>
<title>CSS Exercises</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script src="script.js"></script>
<!-- You do not need to do anything with script.js right now! Later, we will learn how to add JavaScript to websites! --->
<h1 class="center">My Very Cool Web Page</h1>
<h2 class="center">Why this Website is Very Cool</h2>
<ol id="list-color">
<li>I made it!</li>
<li>This website is colorful!</li>
</ol>
<h2 class="center" id="cool-text">Why I love Web Development</h2>
<p>Web Development is a very cool skill that I love learning!</p>
<p>I love making websites because all I have to do is reload the page to see the changes I have made!</p>
</body>
</html>
1 change: 1 addition & 0 deletions 1 css/exercises/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// You do not need to do anything with script.js right now! Later, we will learn how to add JavaScript to websites!
1 change: 1 addition & 0 deletions 1 css/exercises/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Start adding your styling below! */
14 changes: 14 additions & 0 deletions 14 dom-and-events/exercises/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Flight Simulator</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script src = "script.js"></script>
</head>
<body>
<h1>Flight Simulator</h1>
<p id="statusReport">The shuttle is on the ground</p>
<button id = "liftoffButton">Take off</button>
<button id = "abortMission">Abort mission</button>
</body>
</html>
10 changes: 10 additions & 0 deletions 10 dom-and-events/exercises/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function init () {
const missionAbort = document.getElementById("abortMission");
const button = document.getElementById("liftoffButton");
const paragraph = document.getElementById("statusReport");

// Put your code for the exercises here.

}

window.addEventListener("load", init);
3 changes: 3 additions & 0 deletions 3 dom-and-events/exercises/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1 {
text-decoration: underline;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions 40 dom-and-events/studio/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<title>Flight Simulator</title>
<link rel = "stylesheet" type = "text/css" href = "styles.css" />
<script src = "scripts.js"></script>
</head>
<body>
<div class="centered">
<h1>Flight Simulator</h1>
<h2>Current Flight Status</h2>
<p id = "flightStatus">Space shuttle ready for takeoff</p>
<h2>Shuttle Trajectory</h2>
</div>
<div id="flightDisplay">
<div class="center-block">
<h3>Fuel Levels</h3>
<p>Tank Full</p>
<h3>Astronaut Chat</h3>
<p>Houston, we are ready when you are!</p>
</div>
<div id = "shuttleBackground">
<img src = "LaunchCode_rocketline_white.png" height = "75" width = "75" id = "rocket"/>
</div>
<div class="center-block">
<button id="up">Up</button>
<button id="down">Down</button>
<button id="right">Right</button>
<button id="left">Left</button>
<h3>Space Shuttle Height</h3>
<p id="spaceShuttleHeight">0</p><span> miles</span>
</div>
</div>
<div class="centered">
<button id = "takeoff">Take off</button>
<button id = "landing">Land</button>
<button id = "missionAbort">Abort Mission</button>
</div>
</body>
</html>
2 changes: 2 additions & 0 deletions 2 dom-and-events/studio/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Write your JavaScript code here.
// Remember to pay attention to page loading!
30 changes: 30 additions & 0 deletions 30 dom-and-events/studio/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#shuttleBackground {
background-color: green;
display: inline-block;
height: 80%;
width: 40%;
position: relative;
}

#flightStatus {
color: green;
}

#flightDisplay {
text-align: center;
height: 400px;
width: 100%;
}

#spaceShuttleHeight {
display: inline-block;
}

.center-block {
text-align: center;
display: inline-block;
}

.centered {
text-align: center;
}
7 changes: 7 additions & 0 deletions 7 exceptions/exercises/divide.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@
// However, if the denominator is zero you should throw the error, "Attempted to divide by zero."

// Code your divide function here:

function divide (numerator, denominator) {
if(denominator === 0) {
throw Error("Attempted to divide by zero!");
}
return numerator/denominator;
}
34 changes: 32 additions & 2 deletions 34 exceptions/exercises/test-student-labs.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
function gradeLabs(labs) {
let studentLabs2 = [
{
student: 'Blake',
myCode: function (num) {
return Math.pow(num, num);
}
},
{
student: 'Jessica',
runLab: function (num) {
return Math.pow(num, num);
}
},
{
student: 'Mya',
runLab: function (num) {
return num * num;
}
}
];


function gradeLabs(labs, studentLabs2) {
for (let i=0; i < labs.length; i++) {
let lab = labs[i];
let result = lab.runLab(3);
console.log(`${lab.student} code worked: ${result === 27}`);
}

try {
result = lab.runLab(3);
console.log(`Students code worked: ${result === 27}`);
} catch(err) {
result = "Error thrown";
console.log("Error thrown");
}
}

let studentLabs = [
Expand All @@ -21,4 +51,4 @@ let studentLabs = [
}
];

gradeLabs(studentLabs);
gradeLabs(studentLabs, studentLabs2);
24 changes: 24 additions & 0 deletions 24 html/exercises/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>HTML Exercise</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!-- DON'T TOUCH ANYTHING ABOVE THIS LINE -->
</head>
<body>
<!-- h1 goes here -->
<h1>Why I Love Web Development</h1>
<!-- ol goes here -->
<ol>
<li>Fun (sometimes)</li>
<li>Something I have potential with</li>
<li>Important</li>
</ol>
<!-- a goes here -->
<a href="https://github.com">Github.com</a>
<!-- p goes here -->
<p>Github is a helpful site that allows developers to host code and other projects, track changes, and keep track of other important information</p>
</body>
</html>
12 changes: 12 additions & 0 deletions 12 loops/studio/node_modules/.bin/browserslist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions 17 loops/studio/node_modules/.bin/browserslist.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.