This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
Real procedure ceiling(number); Real number; | |
begin | |
Integer numberAsInt; | |
numberAsInt := number; | |
if numberAsInt < number then | |
numberAsInt := numberAsInt + 1; | |
ceiling := numberAsInt; | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data.OleDb; | |
using System.Reflection; | |
using NUnit.Framework; | |
namespace Excel.CustomerTests | |
{ | |
[TestFixture] | |
public class MathsCustomerTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Mars Rover', () => { | |
[ | |
{facing: 'N', endsFacing: 'E'}, | |
{facing: 'E', endsFacing: 'S'}, | |
{facing: 'S', endsFacing: 'W'}, | |
{facing: 'W', endsFacing: 'N'} | |
].forEach(({facing, endsFacing}) => { | |
it('turns right from ${facing} to ${endsFacing}', () => { | |
let rover = {facing: facing}; | |
rover = exec(rover, 'R'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDENTIFICATION DIVISION. | |
PROGRAM-ID. BASKET-TEST. | |
DATA DIVISION. | |
FILE SECTION. | |
WORKING-STORAGE SECTION. | |
COPY 'total_params.cpy'. | |
COPY 'test_context.cpy'. | |
01 expected PIC 9(04)V9(2). | |
PROCEDURE DIVISION. | |
MAIN-PROCEDURE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDENTIFICATION DIVISION. | |
PROGRAM-ID. SQRT. | |
DATA DIVISION. | |
WORKING-STORAGE SECTION. | |
01 prev PIC 9(08)V9(12) VALUE ZEROES. | |
LINKAGE SECTION. | |
01 num PIC 9(08)V9(12). | |
01 root PIC 9(08)V9(12) VALUE ZEROES. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
function CD(artist, title, stock) { | |
this.stock = stock; | |
this.getStock = function () { | |
return this.stock; | |
}; | |
this.buy = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
function Warehouse(catalogue) { | |
this.catalogue = catalogue; | |
this.getCd = function (artist, title) { | |
return this.catalogue.find((cd) => cd.artist == artist && cd.title == title); | |
}; | |
this.buyCd = function (artist, title, catalogue) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
function Warehouse(catalogue) { | |
this.catalogue = catalogue; | |
this.getCd = function (artist, title) { | |
return this.catalogue.find((cd) => cd.artist == artist && cd.title == title); | |
} | |
this.updatedCatalogue = function (cd, boughtCd) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buyCd(artist, title, catalogue) { | |
const cd = catalogue.find((cd => cd.artist == artist && cd.title == title)); | |
return {...catalogue, [catalogue.indexOf(cd)] : {...cd, stock: cd.stock-1}}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.codemanship.xmastrain; | |
public class TrainMotion { | |
private static final int SECONDS_PER_HOUR = 3600; | |
private static final int METRES_PER_KM = 1000; | |
private final double acceleration; | |
private final double topSpeed; | |
private double velocity; | |
private double distance; | |
private final Sensor sensor; |
NewerOlder