Skip to content

peteretep/calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  • Ruby version 1.9.3

  • Rails version 4.0.2

A webpage with a simple calculator consisting of:

* two input fields, called a and b
* four buttons labeled sum, difference, multiplication and division
* one textarea element with edit mode disabled (read-only)

Calculator must operate only on non-negative integer numbers lower than 100. When the form is invalid, the four buttons mentioned above should be disabled.

When user fills the form and clicks one of the buttons, the form content should be sent to the server with AJAX POST call; and the server response put directly into textarea element.

Server-side code should work in following way:

* in case of invalid data provided “error” text should be returned
* all calculations previously made should be stored in the database
* if an operation with given parameters hasn't been made yet, it should be saved 
* otherwise calculation result should be fetched from DB

server response should equal to 4 lines of text in following format:

* Operation: A
* Result: B
* ID: C
* Count: D, where:
    A will be equal to text interpretation of the operation
    B will be equal to calculation result
    C will be an DB document/record ID where given operation data is stored
    D will equal to number of previous calls for given operation

The form should be inactive during the data calculation on the server side, i.e. the user is not allowed to request another calculation if the previous one is not finished Source code of the application above should be sent in form of a ZIP archive file

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors