Here's a simple programme made to calculate the amount of paint (&& layers [*sh joke]) required to completely fill a room with layers of dried paint.

It's written in Python3.8, (I know it's pseudo-code, but it gets the job done)

Here's the source :

Code:
'''
Name : paintRoomCalc.py
Desc : Calcualate how much paint to fill a room
by : Аїӡек Меѥҏ
Copyright : N/A
Date : 4/4/20
'''

from colorama import Fore, Back, Style


def getLayers(roomWidth, roomDepth, roomHeight, paintThick):
    i = 0
    t = 0
    roomWidth = roomWidth * 12
    roomDepth = roomDepth * 12
    roomHeight = roomHeight * 12
    roomVol = roomWidth * roomDepth * roomHeight
    while roomVol >= 0:
        #account for walls
        wallOne = roomWidth * roomHeight
        #print("wallWidth : "+str(wallOne))
        wallThree = roomDepth * roomHeight
        #print("wallDepth : "+str(wallThree))
        wallFive = roomDepth * roomWidth
        #print("wallCeil : "+str(wallFive))

        wallVol = (wallOne * 2 + wallThree * 2 + wallFive) * paintThick
        wallArea = wallOne * 2 + wallThree * 2 + wallFive

        roomWidth = roomWidth - (paintThick * 2)
        roomDepth = roomDepth - (paintThick * 2)
        roomHeight = roomHeight - (paintThick * 2)

        #account for edges going up & down
        edgeUpVol = roomHeight*paintThick**2
        edgeUpVol = edgeUpVol*2
        edgeUpArea = roomHeight*paintThick
        edgeUpVol = edgeUpArea*2

        #account for edges going side to side {on ceiling}
        ##account for edges going side to side {depth}
        edgeSideDepthVol = (roomDepth*paintThick**2)
        edgeSideDepthVol = edgeSideDepthVol*2
        edgeSideDepthArea = (roomDepth*paintThick)
        ##account for edges going side to side {width}
        edgeSideWidthVol = roomWidth*paintThick**2
        edgeSideWidthVol = edgeSideWidthVol*2
        edgeSideWidthArea = roomWidth*paintThick
       
        #add edges
        edgeVol = edgeUpVol+edgeSideWidthVol+edgeSideDepthVol
        edgeArea = edgeUpArea+edgeSideWidthArea+edgeSideDepthArea

        #calculate final values
        roomVol = roomVol - wallVol - edgeVol
        wallArea = wallArea - edgeArea

        i += 1
        t += wallArea
    print(Style.RESET_ALL + Fore.LIGHTMAGENTA_EX + str(i) +
          " layers to fill your room with paint!!")
    print("& " + str(t / (4800)) + " gallons of paint")


print(Fore.LIGHTGREEN_EX + Back.BLACK + "Paint Layer Calculator")
print("by : Аїӡек Меѥҏ")
print(Style.RESET_ALL)
roomWidth = input(Fore.BLUE + "Room Width in Feet? ")
roomWidth = int(roomWidth)
roomDepth = input("Room Depth in Feet? ")
roomDepth = int(roomDepth)
roomHeight = input("Room Height in Feet? ")
roomHeight = int(roomHeight)

print("\n")
print(Style.RESET_ALL + Fore.RED + "1 mil is 1/1000 of an inch")
paintThickMil = input(Style.RESET_ALL + Fore.BLUE +
                      "Paint Thickness in Mils? ")
paintThickMil = int(paintThickMil)
paintThick = paintThickMil / 1000
print("\n")
print(Fore.GREEN + Back.BLACK + "Calculating...")
getLayers(roomWidth, roomDepth, roomHeight, paintThick)


As you can see, it does ANSI terminal colours as well, b/c paint's colourful.

Here's a demo of it running :
https://paintroomcalc.isaacmeyer.repl.run/

NOTE :
An average single coat of paint averages 'round 1-2 mil (one mil is one one-thousanth of an inch)

EDIT :
I added in calculations for the edges, thanks to MateoConLechuga's Idea
Double posting 'cus it's been a day

Mateo, you're gonna hate me for this, but I ported the code to Node.js, yay, efficiency.


Code:
const prompt = require('prompt-sync')();
const colors = require('colors');

function getLayers(roomWidth, roomDepth, roomHeight, paintThick) {
  var edgeArea, edgeSideDepthArea, edgeSideDepthVol, edgeSideWidthArea, edgeSideWidthVol, edgeUpArea, edgeUpVol, edgeVol, i, roomVol, t, wallArea, wallFive, wallOne, wallThree, wallVol;
  i = 0;
  t = 0;
  roomWidth = (roomWidth * 12);
  roomDepth = (roomDepth * 12);
  roomHeight = (roomHeight * 12);
  roomVol = ((roomWidth * roomDepth) * roomHeight);
  while ((roomVol >= 0)) {
    wallOne = (roomWidth * roomHeight);
    wallThree = (roomDepth * roomHeight);
    wallFive = (roomDepth * roomWidth);
    wallVol = ((((wallOne * 2) + (wallThree * 2)) + wallFive) * paintThick);
    wallArea = (((wallOne * 2) + (wallThree * 2)) + wallFive);
    roomWidth = (roomWidth - (paintThick * 2));
    roomDepth = (roomDepth - (paintThick * 2));
    roomHeight = (roomHeight - (paintThick * 2));
    edgeUpVol = (roomHeight * Math.pow(paintThick, 2));
    edgeUpVol = (edgeUpVol * 2);
    edgeUpArea = (roomHeight * paintThick);
    edgeUpVol = (edgeUpArea * 2);
    edgeSideDepthVol = (roomDepth * Math.pow(paintThick, 2));
    edgeSideDepthVol = (edgeSideDepthVol * 2);
    edgeSideDepthArea = (roomDepth * paintThick);
    edgeSideWidthVol = (roomWidth * Math.pow(paintThick, 2));
    edgeSideWidthVol = (edgeSideWidthVol * 2);
    edgeSideWidthArea = (roomWidth * paintThick);
    edgeVol = ((edgeUpVol + edgeSideWidthVol) + edgeSideDepthVol);
    edgeArea = ((edgeUpArea + edgeSideWidthArea) + edgeSideDepthArea);
    roomVol = ((roomVol - wallVol) - edgeVol);
    wallArea = (wallArea - edgeArea);
    i += 1;
    t += wallArea;
  }
  console.log(colors.magenta(i.toString() + " layers to fill your room with paint!!"));
  console.log(colors.magenta(("& " + (t / 4800).toString()) + " gallons of paint"));
}
console.log(colors.bgBlack.green("Paint Layer Calculator"));
console.log(colors.bgBlack.green("by : Аїӡек Меѥҏ"));
console.log("\n")
let roomWidth = prompt(colors.blue("Room Width in Feet? "));
roomWidth = Number(roomWidth);
let roomDepth = prompt(colors.blue("Room Depth in Feet? "));
roomDepth = Number(roomDepth);
let roomHeight = prompt(colors.blue("Room Height in Feet? "));
roomHeight = Number(roomHeight);
console.log("\n");
console.log(colors.red("1 mil is 1/1000 of an inch"));
let paintThickMil = prompt(colors.blue("Paint Thickness in Mils? "));
paintThickMil = Number(paintThickMil);
paintThick = (paintThickMil / 1000);
console.log("\n");
console.log(colors.bgBlack.green("Calculating..."));
getLayers(roomWidth, roomDepth, roomHeight, paintThick);


if you's wanna run this version here's the link :
https://paintRoomCalcJS.isaacmeyer.repl.run
"Yay efficiency"? Javascript isn't inherently any better than Python.

(I quite like Python.)
Tari wrote:
"Yay efficiency"? Javascript isn't inherently any better than Python.

(I quite like Python.)


I meant I'm able to push out a transpiled program pretty quickly because the languages are so similar
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement