Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board Paint Required becomes Semi-Precious Download Source Code
Author Details Code Information
supertunaman ( Tuna )

Pinned 1 Codes
Posted 0 Coding Articles

Send A Message
View Coders Profile
Language Ruby
Expires Never
Length 517 Characters (16 Lines)
Password no password
Description

I Rubyized shadytyrant's paint program. Why? I dunno. Felt like it.

Well I'm not gonna say which language is better, but I do know that a lot of people are afraid of VB6. Ruby is trendy, hot, and has a great community around it. Most people aren't quite as afraid of it.

When I was a young boy, I had my eyes exposed to VB6, and no, I did not like it. I could however read and understand it, so I was able to Rubyize it for people who have weaker eyes. It seemed like a good program to me, it just wasn't where people could see it!

Enjoy. I hope you never buy the wrong amount of paint again.
  1. #!/usr/bin/ruby
  2.  
  3. def gallonsOfPaint(height, length, width)
  4.        #I'm just going to safely assume that nobody's screwing with me and put integers for args
  5.        #Too lazy to try to validate them.
  6.        gallons = ((height * length) * 2) + ((height * width) * 2) + (length * width)
  7.        return gallons / 400 #this uses shadytyrant's formula.
  8. end
  9.  
  10. puts "Height of room?"
  11. h = gets.chomp.to_i #ah, hell, why not?
  12. puts "Length of room?"
  13. l = gets.chomp.to_i
  14. puts "Width of room?"
  15. w = gets.chomp.to_i
  16. puts gallonsOfPaint(h, l, w)
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
 
supertunaman     Posted 3.44 Years Ago
 
 
"Good job rewrieting this program."

o hay thanx. But it's spelled "rewriting". *ducks*

"Haha, \"Why? I dunno. Felt like it.\" ;-)"

Yep. Pretty much.

"You know you would be better of posting this as a \"source
code\" on your
profile... since i will be deleting this code pin board next year in favor of the
source code application."

Eh, I don't feel like it's enough code to warrant that. After all,
it's only two lines of real, actual code. I could make it one line, akshully.
 
VBAssassin     Posted 3.48 Years Ago
 
 
Haha, "Why? I dunno. Felt like it." ;-)

You know you would be better of posting this as a "source code" on your
profile... since i will be deleting this code pin board next year in favor of the
source code application.

Nice work anyway ;-)

Kind regards,
Scott
 
shadytyrant     Posted 3.49 Years Ago
 
 
Good job rewrieting this program.
 
otoom     Posted 3.55 Years Ago
 
 
Ruby is a nice language to pick up.

Obviously the thing with such like ruby, python, perl etc is that they are
scripting languages and have to be interpretted.

Other than that this is a nice trendy (like you said) language to go for.

Very nice mate.
Page 1 of 1
 
 
Latest News About Coder Profile
Coder Profile Poll
Which sounds better on your coder profiles, and makes more sense to you (think twitter, facebook, etc)?

Followers / Following
Fans / Following
Fans / Fan Of


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.49 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved