Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jasongorman's full-sized avatar

Jason Gorman jasongorman

View GitHub Profile
begin
Real procedure ceiling(number); Real number;
begin
Integer numberAsInt;
numberAsInt := number;
if numberAsInt < number then
numberAsInt := numberAsInt + 1;
ceiling := numberAsInt;
end;
using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Reflection;
using NUnit.Framework;
namespace Excel.CustomerTests
{
[TestFixture]
public class MathsCustomerTests
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');
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.
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.
const assert = require('assert');
function CD(artist, title, stock) {
this.stock = stock;
this.getStock = function () {
return this.stock;
};
this.buy = function () {
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) {
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) {
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}};
}
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;