Good Day

I have a program I am coding, but I have a peoblem with the calculation below.
Oh the Application is for a Wallpaper App to calculate the number of single rolls
of wallpaper required to cover a room.
I attached a picture of the program

Question:

If the roll coverage is 45.5 sqrFt and the length, width and height of the room are 15, 18 and 20 respectively, the number of single roll will be 30

Can't really answer yet. Specification incomplete.

For example some wallpaper has you line it up on a pattern so there is some material loss.

That is, the wall is about 2.3 Meters (if you make an app, consider using The Metric System too.
So another field would be the pattern repeat distance. I'd also change Height to Maximum Wall Height just to cover that odd room.

Now that you have the repeat pattern entry you can work out the math.

Use the max wall height and bump that length up to the repeat line on the paper. Now it's not so hard as it's just the linear wall run of 2 times Length plus 2 times Width divided by the width of the paper. If there's a fraction you round up the full integer. That's the number of strips you will have to have.

Change the roll coverage of square feet to the roll's length. They used to always give you full repeats in the roll so we don't need to tackle that today.

At this point it's the integer you have now for the number of strips times their length gives you the total meters or feet we need for the project given that roll width. Now the last step to find the number of rolls is to divide this number by the meters in a roll and round up since you can't buy less than a roll.

For a paper with no pattern you would just add the area of the four walls and divide by the coverage-per-roll to get the number of rolls. I find it hard to believe that you are papering a room that is 20 feet high but using your numbers the total area would be

``18 x 20 x 2 + 15 x 20 x 2``

which works out to 1320 square feet. Based on 45.5 square feet per roll that results in a tad over 29 rolls. But you have to consider the pattern. The amount of waste will depend on how much of the roll you will have to throw away in order to align the pattern of one strip with the pattern ot the next strip.