import java.util.*;
public class GeneralizationsD {
public static void main(String[] args) {
ArrayList<String> sports = new
ArrayList<String>();
sports.add("Football");
sports.add("Boxing");
for(String sport : sports) {
System.out.println(sport);
}
//Major cities and the year they were founded
HashMap<String, Integer> majorCities = new HashMap<String, Integer>();
majorCities.put("New York", 1624);
majorCities.put("London", 43);
majorCities.put("Mexico City", 1521);
majorCities.put("Sao Paulo", 1554);
for (String city : majorCities.keySet()) {
System.out.println(city + " was founded in " + majorCities.get(city));
}
}
}
Quotes help make search much faster. Example: "Practice Makes Perfect"
Thursday, October 29, 2015
Codecademy > Learn Java > Iterating over a HashMap Sample Solution
import java.util.HashMap;
public class RestaurantForEach {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
restaurantMenu.put("Turkey Burger", 13);
restaurantMenu.put("Naan Pizza", 11);
restaurantMenu.put("Cranberry Kale Salad", 10);
System.out.println(restaurantMenu.size());
for (String item : restaurantMenu.keySet()) {
System.out.println("A " + item + " costs " + restaurantMenu.get(item) + " dollars.");
}
}
}
public class RestaurantForEach {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
restaurantMenu.put("Turkey Burger", 13);
restaurantMenu.put("Naan Pizza", 11);
restaurantMenu.put("Cranberry Kale Salad", 10);
System.out.println(restaurantMenu.size());
for (String item : restaurantMenu.keySet()) {
System.out.println("A " + item + " costs " + restaurantMenu.get(item) + " dollars.");
}
}
}
Codecademy > Learn Java > HashMap: Access Sample Solution
import java.util.HashMap;
public class Restaurant {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
restaurantMenu.put("Turkey Burger", 13);
restaurantMenu.put("Naan Pizza", 11);
restaurantMenu.put("Cranberry Kale Salad", 10);
System.out.println( restaurantMenu.get("Naan Pizza") );
}
}
public class Restaurant {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
restaurantMenu.put("Turkey Burger", 13);
restaurantMenu.put("Naan Pizza", 11);
restaurantMenu.put("Cranberry Kale Salad", 10);
System.out.println( restaurantMenu.get("Naan Pizza") );
}
}
Codecademy > Learn Java > HashMap: Manipulation Sample Solution
import java.util.HashMap;
public class Restaurant {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
restaurantMenu.put("Turkey Burger", 13);
restaurantMenu.put("Naan Pizza", 11);
restaurantMenu.put("Cranberry Kale Salad", 10);
}
}
public class Restaurant {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
restaurantMenu.put("Turkey Burger", 13);
restaurantMenu.put("Naan Pizza", 11);
restaurantMenu.put("Cranberry Kale Salad", 10);
}
}
Codecademy > Learn Java > HashMap Sample Solution
import java.util.HashMap;
public class Restaurant {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
}
}
public class Restaurant {
public static void main(String[] args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
}
}
Codecademy > Learn Java > For Each Loop Sample Solution
import java.util.ArrayList;
public class TemperaturesForEach {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
for (Integer temperature : weeklyTemperatures) {
System.out.println(temperature);
}
}
}
public class TemperaturesForEach {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
for (Integer temperature : weeklyTemperatures) {
System.out.println(temperature);
}
}
}
Codecademy > Learn Java > Iterating over an ArrayList Sample Solution
import java.util.ArrayList;
public class TemperaturesC {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
weeklyTemperatures.add(2, 111);
for (int j = 0; j < weeklyTemperatures.size(); j++) {
System.out.println( weeklyTemperatures.get(j) );
}
}
}
public class TemperaturesC {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
weeklyTemperatures.add(2, 111);
for (int j = 0; j < weeklyTemperatures.size(); j++) {
System.out.println( weeklyTemperatures.get(j) );
}
}
}
Codecademy > Learn Java > ArrayList: Insertion Sample Solution
import java.util.ArrayList;
public class TemperaturesB {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
weeklyTemperatures.add(2, 111);
System.out.println(weeklyTemperatures.get(3));
}
}
public class TemperaturesB {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
weeklyTemperatures.add(2, 111);
System.out.println(weeklyTemperatures.get(3));
}
}
Codecademy > Learn Java > ArrayList: Access Sample Solution
import java.util.ArrayList;
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
System.out.println(weeklyTemperatures.get(1));
}
}
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
System.out.println(weeklyTemperatures.get(1));
}
}
Codecademy > Learn Java > ArrayList: Manipulation Sample Solution
import java.util.ArrayList;
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
}
}
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
}
}
Codecademy > Learn Java > ArrayList Sample Solution
import java.util.ArrayList;
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
}
}
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
}
}
Codecademy > Learn Java > For Loop Sample Solution
public class For {
public static void main(String[] args) {
for (int waterLevel = 0; waterLevel < 7; waterLevel++) {
System.out.println("The pool's water level is at " + waterLevel + " feet.");
}
}
}
public static void main(String[] args) {
for (int waterLevel = 0; waterLevel < 7; waterLevel++) {
System.out.println("The pool's water level is at " + waterLevel + " feet.");
}
}
}
Codecademy > Learn Java > Generalizations Coffee.java Sample Solution
class Coffee extends Beverage{
public Coffee() {
}
public void addSugar(int cubes) {
System.out.println("You added " + cubes + " sugar cubes.");
}
public static void main(String[] args) {
Coffee myOrder = new Coffee();
myOrder.addSugar(2);
myOrder.isFull();
}
}
public Coffee() {
}
public void addSugar(int cubes) {
System.out.println("You added " + cubes + " sugar cubes.");
}
public static void main(String[] args) {
Coffee myOrder = new Coffee();
myOrder.addSugar(2);
myOrder.isFull();
}
}
Codecademy > Learn Java > Inheritance Sample Solution
class Dog extends Animal{
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public void run(int feet) {
System.out.println("Your dog ran " + feet + " feet!");
}
public int getAge() {
return age;
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
spike.run(100);
int spikeAge = spike.getAge();
System.out.println(spikeAge);
spike.checkStatus();
}
}
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public void run(int feet) {
System.out.println("Your dog ran " + feet + " feet!");
}
public int getAge() {
return age;
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
spike.run(100);
int spikeAge = spike.getAge();
System.out.println(spikeAge);
spike.checkStatus();
}
}
Codecademy > Learn Java > Using Methods: II Sample Solution
class Dog{
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public void run(int feet) {
System.out.println("Your dog ran " + feet + " feet!");
}
public int getAge() {
return age;
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
spike.run(100);
int spikeAge = spike.getAge();
System.out.println(spikeAge);
}
}
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public void run(int feet) {
System.out.println("Your dog ran " + feet + " feet!");
}
public int getAge() {
return age;
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
spike.run(100);
int spikeAge = spike.getAge();
System.out.println(spikeAge);
}
}
Codecademy > Learn Java > Methods: II Sample Solution
class Dog{
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public void run(int feet) {
System.out.println("Your dog ran " + feet + " feet!");
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
spike.run(100);
}
}
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public void run(int feet) {
System.out.println("Your dog ran " + feet + " feet!");
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
spike.run(100);
}
}
Codecademy > Learn Java > Using Methods: I Sample Solution
class Dog{
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
}
}
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public static void main(String[] args) {
Dog spike = new Dog(1);
spike.bark();
}
}
Codecademy > Learn Java > Methods: I Sample Solution
class Dog{
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public static void main(String[] args) {
Dog spike = new Dog(1);
}
}
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public static void main(String[] args) {
Dog spike = new Dog(1);
}
}
Codecademy > Learn Java > Objects Sample Solution
class Dog{
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public static void main(String[] args) {
Dog spike = new Dog(1);
}
}
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public static void main(String[] args) {
Dog spike = new Dog(1);
}
}
Codecademy > Learn Java > Classes: Constructor Parameters Sample Solution
class Dog{
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public static void main(String[] args) {
}
}
int age;
public Dog(int dogsAge){
age = dogsAge;
}
public static void main(String[] args) {
}
}
Codecademy > Learn Java > Classes: Instance Variables Sample Solution
class Dog{
int age;
public Dog(){
}
public static void main(String[] args) {
}
}
int age;
public Dog(){
}
public static void main(String[] args) {
}
}
Codecademy > Learn Java > Classes: Constructors Sample Solution
class Dog{
public Dog(){
}
public static void main(String[] args) {
}
}
public Dog(){
}
public static void main(String[] args) {
}
}
Codecademy > Learn Java > Classes: Syntax Sample Solution
class Dog{
public static void main(String[] args) {
}
}
public static void main(String[] args) {
}
}
Codecademy > Learn Java > GeneralizationsB.java Sample Solution
public class GeneralizationsB {
public static void main(String[] args) {
// ( 3 >= 3 && !(true || true) )
boolean tricky = false;
if(2015 > 2016) {
System.out.println("Stuck in the past...");
}else {
System.out.println("Upgraded to the future!");
}
int subwayTrain = 5;
switch (subwayTrain){
case 1 : System.out.println("This is a South Ferry bound train!");
break;
case 5 : System.out.println("This is a Brooklyn bound train!");
break;
case 7 : System.out.println("This is a Queens bound train!");
break;
default:
System.out.println("I'm not sure where that train goes...");
}
}
}
public static void main(String[] args) {
// ( 3 >= 3 && !(true || true) )
boolean tricky = false;
if(2015 > 2016) {
System.out.println("Stuck in the past...");
}else {
System.out.println("Upgraded to the future!");
}
int subwayTrain = 5;
switch (subwayTrain){
case 1 : System.out.println("This is a South Ferry bound train!");
break;
case 5 : System.out.println("This is a Brooklyn bound train!");
break;
case 7 : System.out.println("This is a Queens bound train!");
break;
default:
System.out.println("I'm not sure where that train goes...");
}
}
}
Codecademy > Learn Java > Switch Statement Sample Solution
public class Switch {
public static void main(String[] args) {
char penaltyKick = 'L';
switch (penaltyKick) {
case 'L': System.out.println("Messi shoots to the left and scores!");
break;
case 'R': System.out.println("Messi shoots to the right and misses the goal!");
break;
case 'C': System.out.println("Messi shoots down the center, but the keeper blocks it!");
break;
default:
System.out.println("Messi is in position...");
}
}
}
public static void main(String[] args) {
char penaltyKick = 'L';
switch (penaltyKick) {
case 'L': System.out.println("Messi shoots to the left and scores!");
break;
case 'R': System.out.println("Messi shoots to the right and misses the goal!");
break;
case 'C': System.out.println("Messi shoots down the center, but the keeper blocks it!");
break;
default:
System.out.println("Messi is in position...");
}
}
}
Codecademy > Learn Java > Ternary Conditional Sample Solution
public class Ternary {
public static void main(String[] args) {
int fuelLevel = 3;
char canDrive = (fuelLevel > 0) ? 'Y' : 'N';
System.out.println(canDrive);
}
}
public static void main(String[] args) {
int fuelLevel = 3;
char canDrive = (fuelLevel > 0) ? 'Y' : 'N';
System.out.println(canDrive);
}
}
Codecademy > Learn Java > If-ElseIf-Else Statement Sample Solution
public class IfElseIf {
public static void main(String[] args) {
int round = 7;
if (round > 12) {
System.out.println("The match is over!");
} else if (round > 0) {
System.out.println("The match is underway!");
} else {
System.out.println("The boxing match hasn't started yet.");
}
}
}
public static void main(String[] args) {
int round = 7;
if (round > 12) {
System.out.println("The match is over!");
} else if (round > 0) {
System.out.println("The match is underway!");
} else {
System.out.println("The boxing match hasn't started yet.");
}
}
}
Codecademy > Learn Java > If-Else Statement Sample Solution
public class IfElse {
public static void main(String[] args) {
if (7 < 7) {
System.out.println("Try again...");
} else {
System.out.println("Success!");
}
}
}
public static void main(String[] args) {
if (7 < 7) {
System.out.println("Try again...");
} else {
System.out.println("Success!");
}
}
}
Codecademy > Learn Java > If Statement Sample Solution
public class If {
public static void main(String[] args) {
if (true) {
System.out.println("Access granted.");
}
}
}
public static void main(String[] args) {
if (true) {
System.out.println("Access granted.");
}
}
}
Codecademy > Learn Java > Precedence Sample Solution
public class Precedence {
public static void main(String[] args) {
boolean riddle = !( 1 < 8 || (5 > 2 && 3 < 5));
System.out.println(riddle);
}
}
public static void main(String[] args) {
boolean riddle = !( 1 < 8 || (5 > 2 && 3 < 5));
System.out.println(riddle);
}
}
Codecademy > Learn Java > Boolean Operators: ! Sample Solution
public class Not {
public static void main(String[] args) {
System.out.println(!false);
System.out.println( !(5>=1) );
}
}
public static void main(String[] args) {
System.out.println(!false);
System.out.println( !(5>=1) );
}
}
Codecademy > Learn Java > Boolean Operators: || Sample Solution
public class Or {
public static void main(String[] args) {
System.out.println(true || false);
}
}
public static void main(String[] args) {
System.out.println(true || false);
}
}
Codecademy > Learn Java > Boolean Operators: && Sample Solution
public class And {
public static void main(String[] args) {
System.out.println(true && true);
}
}
public static void main(String[] args) {
System.out.println(true && true);
}
}
Codecademy > Learn Java > Generalizations Sample Solution
//Sample Solution
public class Generalizations {
public static void main(String[] args) {
boolean isComplete = true;
int awesomeLevel = 121;
int epicLevel = awesomeLevel * 2;
System.out.println(epicLevel);
}
}
public class Generalizations {
public static void main(String[] args) {
boolean isComplete = true;
int awesomeLevel = 121;
int epicLevel = awesomeLevel * 2;
System.out.println(epicLevel);
}
}
Codecademy > Learn Java > Equality Operators Sample Solution
public class EqualityOperators {
public static void main(String[] args) {
System.out.println(true != false);
}
}
public static void main(String[] args) {
System.out.println(true != false);
}
}
Codecademy > Learn Java > Relational Operators Sample Solution
public class RelationalOperators {
public static void main(String[] args) {
System.out.println(3 < 7);
}
}
public static void main(String[] args) {
System.out.println(3 < 7);
}
}
Codecademy > Learn Java > Math: %
//Sample Solution
public class Modulo {
public static void main(String[] args) {
int myRemainder = 6 % 4;
System.out.println(myRemainder);
}
}
public class Modulo {
public static void main(String[] args) {
int myRemainder = 6 % 4;
System.out.println(myRemainder);
}
}
Codecademy > Learn Java > Math: +, -, *, and /
//Sample Solution
public class Arithmetic {
public static void main(String[] args) {
int myNumber = 3 * 7;
System.out.println(myNumber);
}
}
public class Arithmetic {
public static void main(String[] args) {
int myNumber = 3 * 7;
System.out.println(myNumber);
}
}
Codecademy > Learn Java > Comments Sample Solution
public class Comments {
public static void main(String[] args) {
//System.out.println("Noise!");
/*
anything you like!
*/
}
}
public static void main(String[] args) {
//System.out.println("Noise!");
/*
anything you like!
*/
}
}
Codecademy > Learn Java > Whitespace Sample Solution
public class WhiteSpace {
public static void main(String[] args) {
boolean isFormatted = false;
System.out.println(isFormatted);
}
}
public static void main(String[] args) {
boolean isFormatted = false;
System.out.println(isFormatted);
}
}
Codecademy > Learn Java > Variables Sample Solution
public class Variables {
public static void main(String[] args) {
int myNumber = 42;
boolean isFun = true;
char movieRating = 'A';
}
}
public static void main(String[] args) {
int myNumber = 42;
boolean isFun = true;
char movieRating = 'A';
}
}
Saturday, September 5, 2015
What should you do when you hear the siren of an emergency vehicle on a lane fit for one?
Answer: pull to the right and stop, ensuring that the emergency vehicle can get ahead of you
What is a driver required to do if there are pedestrians on a school crossing?
Answer: He should stop and wait until all individuals are completely off the crossing before proceeding.
When approaching a railway crossing, how far should you stop from the nearest rail?
Answer: If a signal device warns of an approaching train, you should stop not less than 1.5 meters from the nearest rail
What hand signal indicates that the driver will turn left at the next intersection?
Answer: Driver extends his left arm straight out
What hand signal must a driver give when he wants to slow down and stop?
Answer: The left arm should be held down with the hand pointing at the ground
What is the proper hand signal for a right turn?
Answer: The left arm bent at the elbow with the hand pointing up
When is the only time you can drive across solid yellow lines?
Answer: When turning left
Thursday, August 20, 2015
What do two solid yellow lines indicate?
Answer: If the center of the road is marked by two solid yellow lines, you are in a No-Passing zone
How do you know that the road you are on will get narrower?
Answer: There will be a solid white line on the right edge of the highway that slants to your left.
What does a flashing yellow light at a road crossing indicate?
Answer: You have to slow down and proceed with caution.
What traffic signs are colored blue?
Answer: Information signs
What kind of information do yellow triangular signs provide?
Answer: These are warnings
Friday, April 17, 2015
Codecademy ng-repeat I
//sample solution to MainController.js
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
$scope.products =
[
{
name: 'The Book of Trees',
price: 19,
pubdate: new Date('2014', '03', '08'),
cover: 'img/the-book-of-trees.jpg'
},
{
name: 'Program or be Programmed',
price: 8,
pubdate: new Date('2013', '08', '01'),
cover: 'img/program-or-be-programmed.jpg'
}
]
}]);
<!-- sample solution for a portion of index.html -->
<div ng-repeat="product in products" class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name }}</p>
<p class="price">{{ product.price | currency }}</p>
<p class="date">{{ product.pubdate | date }}</p>
</div>
</div>
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
$scope.products =
[
{
name: 'The Book of Trees',
price: 19,
pubdate: new Date('2014', '03', '08'),
cover: 'img/the-book-of-trees.jpg'
},
{
name: 'Program or be Programmed',
price: 8,
pubdate: new Date('2013', '08', '01'),
cover: 'img/program-or-be-programmed.jpg'
}
]
}]);
<!-- sample solution for a portion of index.html -->
<div ng-repeat="product in products" class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name }}</p>
<p class="price">{{ product.price | currency }}</p>
<p class="date">{{ product.pubdate | date }}</p>
</div>
</div>
Codecademy Filters II
//Sample solution to MainController.js
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
$scope.product = { name: 'The Book of Trees', price: 19, pubdate: new Date('2014', '03', '08') }
}]);
<!-- sample solution to a portion of index.html -->
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
<div class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name | uppercase }}</p>
<p class="price">{{ product.price | currency }}</p>
<p class="date">{{ product.pubdate | date }}</p>
</div>
</div>
</div>
</div>
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
$scope.product = { name: 'The Book of Trees', price: 19, pubdate: new Date('2014', '03', '08') }
}]);
<!-- sample solution to a portion of index.html -->
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
<div class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name | uppercase }}</p>
<p class="price">{{ product.price | currency }}</p>
<p class="date">{{ product.pubdate | date }}</p>
</div>
</div>
</div>
</div>
Codecademy FIlters I
<!-- sample solution to a portion of index.html -->
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
<div class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name }}</p>
<p class="price">{{ product.price | currency }}</p>
<p class="date"> </p>
</div>
</div>
</div>
</div>
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
<div class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name }}</p>
<p class="price">{{ product.price | currency }}</p>
<p class="date"> </p>
</div>
</div>
</div>
</div>
Codecademy Workflow
//Sample solution to MainController.js
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
$scope.product = { name: 'The Book of Trees', price: 19 }
}]);
<!-- sample solution to index.html -->
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
<div class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name }}</p>
<p class="price">{{ product.price }}</p>
<p class="date"> </p>
</div>
</div>
</div>
</div>
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
$scope.product = { name: 'The Book of Trees', price: 19 }
}]);
<!-- sample solution to index.html -->
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
<div class="col-md-6">
<div class="thumbnail">
<img src="img/the-book-of-trees.jpg">
<p class="title">{{ product.name }}</p>
<p class="price">{{ product.price }}</p>
<p class="date"> </p>
</div>
</div>
</div>
</div>
Codecademy Hello AngularJS II
//Sample Solution for MainController.js
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
}]);
<!--Sample Solution for index.html-->
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
</div>
</div>
app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My Own String';
$scope.promo = 'Your Own String';
}]);
<!--Sample Solution for index.html-->
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ promo }}</h2>
</div>
</div>
Subscribe to:
Posts (Atom)
This is an example of scrolling text using Javascript.
Popular Posts
-
var my_canvas=document.getElementById('canvas'); var context=my_canvas.getContext('2d');
-
This is caused by the entrance of water into the air sacs which makes the lungs doughy, readily pits on pressure, exuding water and froth
-
Question: What current is required for full scale deflection of a galvanometer having a current sensitivity of 50 micro-amperes per scale di...
-
#sample solution print "What's your first name?" first_name = gets.chomp.capitalize! print "What's your last na...
-
//Sample Solution const gameState = {} function preload() { this.load.image('codey', 'https://s3.amazonaws.com/codecademy-...
-
#Sample Solution --- title: "Data Cleaning in R" output: html_notebook --- ```{r message=FALSE, warning=FALSE} # load libra...
-
Solution: SELECT first_name, age, FROM table_name;
-
# Update data types year_1_str = str(year_1) revenue_1_str = str(revenue_1) # Create a complete sentence combining only the string d...
-
#sample solution secret_identities = { "The Batman" => "Bruce Wayne", "Superman" => "Clark Ke...
-
Answer: This is the type of injury when a blow to the forehead causes a contusion of the eyeball due to the fracture of the bone at the r...