Skip to content

Arithmetic problem generator based on parameters. To be used for ditto sheets.

Notifications You must be signed in to change notification settings

shinylightdev/math-problems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Math Problem Generator

Generates random addition and subtraction based on parameters.

Usage

Let's import the following.

import { Problem } from './models/Problem';
import { Operand } from './models/Operand';

Now let's add two numbers:

let problem = new Problem(
    "+", 
    [
      new Operand(1, 5), 
      new Operand(4, 6)
    ]
  );
// Return something like "3+4"
console.log(p.generateExpression()); 

// Returns 7
console.log(p.getAnswer());

// Returns -1
console.log(p.getSubtraction());

// Returns 7
console.log(p.getSum());

Testing

Currently tests are limited. Uses Jasmine to test.

Installing Jasmine for TypeScript:

# Global Jasmine installation 
npm install -g jasmine

# TypeScript Jasmine types
npm install --save @types/jasmine

To run the tests:

npm test

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

Arithmetic problem generator based on parameters. To be used for ditto sheets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published