Kirjaudu
Google-sovellukset
Päävalikko
Post a Comment On:
A Nod to Nothing
"Exercises for Programmers: 57 Challenges to Develop Your Coding Skills - Chapter 3, Paint a Room - Circle"
No comments yet. -
1 – 0 of 0
Variation #2....do a circular room. I find that to be less about coding and more about reminding myself of basic geometry. It's less code than the square room in some respects.
Fiddle:
https://jsfiddle.net/NodToNothing/7buham4g/
All Fiddles:
https://jsfiddle.net/user/NodToNothing/fiddles/
[Image] JS Fiddle Code:
HTML:
Room Radius:
Paint coverage (square feet per gallon)a:
Square Feet: {{sqFeet}}
Gallons of Paint: {{gallons}}
Javascript + Vue 2.2.1 var app = new Vue({ el: '#app', components: { }, data: { radius: 10, coverage: 350 }, computed: { gallons: function(){ //return ((this.pizzas * this.slices) % this.people); //the disadvantage of f-ed up long math in line, you lose your place, that took a few iterations return Math.ceil((this.radius * 3.14 * this.radius) / this.coverage); }, sqFeet: function(){ return (this.radius * 3.14 * this.radius); } } })
posted by Scooter at
2:26 PM
on Mar 10, 2019
Leave your comment
You can use some HTML tags, such as
<b>, <i>, <a>
This blog does not allow anonymous comments.
Comment moderation has been enabled. All comments must be approved by the blog author.
Google Account
You will be asked to sign in after submitting your comment.
Please prove you're not a robot
"Exercises for Programmers: 57 Challenges to Develop Your Coding Skills - Chapter 3, Paint a Room - Circle"
No comments yet. -