
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
Finding length, width and height of the sheet required to cover some area using JavaScript
Problem
We are required to write a JavaScript function that takes in the length, height and width of a room.
Our function should calculate the number of sheets required to cover the whole room given that the width of one single sheet is .52 units and length is 10 units.
For the sake of convenience, we should return the number of rolls such that the length is 15% more than the required length.
Example
Following is the code −
const findSheet = (length, width, height) => { if(length === 0 || width === 0){ return 0; } const roomArea = 2 * (length + width) * height; const rollArea = 0.52 * 10; const required = Math.ceil(roomArea / rollArea * 1.15); return required; }; console.log(findSheet(4, 3.5, 3));
Output
10
- Related Articles
- Finding the height based on width and screen size ratio (width:height) in JavaScript
- Change the width and height of element using CSS
- Finding the length of the diagonal of a cuboid using JavaScript
- How to get the Width and Height of the screen in JavaScript?
- Finding area of triangle in JavaScript using Heron’s formula
- Finding the length of a JavaScript object
- It is required to make a closed cylindrical tank of height 1m and base diameter 140 cm from a metal sheet. How many square metres of the sheet are required for the same?
- How to set width and height of an element using jQuery?
- Half cubic metre of gold-sheet is extended by hammering so as to cover an area of $1$ hectare. Find the thickness of the gold- sheet.
- Finding the length of longest vowel substring in a string using JavaScript
- It is required to make a closed cylindrical tank of height $1\ m$ and base diameter $140\ cm$ from a metal sheet. How many square metres of the sheet are required for the same?
- Curved surface area of a hollow cylinder is $4224\ cm^2$. A rectangular sheet having width $33\ cm$ is formed cutting it along its height. Find perimeter of sheet.
- Getting screens height and width using Tkinter Python
- Set the height and width of an image using percent with CSS
- How to get the height and width of the android.widget.ImageView?

Advertisements