diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index fdd4b2f6..27c81fb5 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,3 +1,54 @@
class ApplicationController < ActionController::Base
+ def blank_square_form
+ render({ :template => "calculation_templates/square_form.html.erb" })
+ end
+ def calculate_square
+
+ # params = {"elephant" => 42}
+
+ @num = params.fetch("elephant").to_f
+ @square_of_num = @num ** 2
+
+ render({ :template => "calculation_templates/square_results.html.erb" })
+ end
+
+ def calculate_random
+ @lower = params.fetch("user_min").to_f
+ @upper = params.fetch("user_max").to_f
+ @result = rand(@lower...@upper)
+
+ render({ :template => "calculation_templates/rand_results.html.erb" })
+ end
+
+ def blank_random_form
+ render({ :template => "calculation_templates/random_form.html.erb" })
+ end
+
+ def square_root_form
+ render({ :template => "calculation_templates/square_root_form.html.erb" })
+ end
+
+ def square_root_results
+ @nums = params.fetch("squareroot_number").to_f
+ @squareroot_of_num = @nums ** (0.5)
+
+ render({ :template => "calculation_templates/square_root_results.html.erb" })
+ end
+
+ def payment_form
+ render({ :template => "calculation_templates/payment_form.html.erb" })
+ end
+
+ def payment_results
+ @num_apr = params.fetch("apr_number").to_f
+ @apr_per_period = (@num_apr / 100) / 12
+ @num_years = params.fetch("years_number").to_f.round(3)
+ @num_principal = params.fetch("principal_number").to_f
+
+ @monthly_payment = ((@apr_per_period * @num_principal) / (1 - (1 + @apr_per_period) ** (-12 * @num_years)))
+
+ @num_apr = @num_apr.to_s(:percentage, precision: 4)
+ render({ :template => "calculation_templates/payment_results.html.erb" })
+ end
end
diff --git a/app/views/calculation_templates/payment_form.html.erb b/app/views/calculation_templates/payment_form.html.erb
new file mode 100644
index 00000000..d6e3dc30
--- /dev/null
+++ b/app/views/calculation_templates/payment_form.html.erb
@@ -0,0 +1,24 @@
+
+
+
+
+
diff --git a/app/views/calculation_templates/square_form.html.erb b/app/views/calculation_templates/square_form.html.erb
new file mode 100644
index 00000000..9e434a2c
--- /dev/null
+++ b/app/views/calculation_templates/square_form.html.erb
@@ -0,0 +1,22 @@
+
+
+
+
+
+
diff --git a/app/views/calculation_templates/square_results.html.erb b/app/views/calculation_templates/square_results.html.erb
new file mode 100644
index 00000000..0dc0c04a
--- /dev/null
+++ b/app/views/calculation_templates/square_results.html.erb
@@ -0,0 +1,16 @@
+
+
+
Square Results
+
+
+
+
+ - Number
+ - <%= @num %>
+
+
+ - Square
+ - <%= @square_of_num %>
+
+
+
Calculate another square
diff --git a/app/views/calculation_templates/square_root_form.html.erb b/app/views/calculation_templates/square_root_form.html.erb
new file mode 100644
index 00000000..346f11b8
--- /dev/null
+++ b/app/views/calculation_templates/square_root_form.html.erb
@@ -0,0 +1,19 @@
+
+
+
+
diff --git a/app/views/calculation_templates/square_root_results.html.erb b/app/views/calculation_templates/square_root_results.html.erb
new file mode 100644
index 00000000..10977492
--- /dev/null
+++ b/app/views/calculation_templates/square_root_results.html.erb
@@ -0,0 +1,15 @@
+
+
Square Root Results
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 9240ef45..31cb3729 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,3 +1,19 @@
Rails.application.routes.draw do
+ get("/square/new", { :controller => "application", :action => "blank_square_form" })
+
+ get("/square/results", { :controller => "application", :action => "calculate_square" })
+
+ get("/random/results", { :controller => "application", :action => "calculate_random" })
+
+ get("/random/new", { :controller => "application", :action => "blank_random_form" })
+
+ get("square_root/new", { :controller => "application", :action => "square_root_form" })
+
+ get("square_root/results", { :controller => "application", :action => "square_root_results"})
+
+ get("payment/new", { :controller => "application", :action => "payment_form" })
+
+ get("payment/results", { :controller => "application", :action => "payment_results"})
+
end
diff --git a/db/development.sqlite3 b/db/development.sqlite3
new file mode 100644
index 00000000..0246b8db
Binary files /dev/null and b/db/development.sqlite3 differ
diff --git a/db/test.sqlite3 b/db/test.sqlite3
new file mode 100644
index 00000000..8fc26d15
Binary files /dev/null and b/db/test.sqlite3 differ