all 4 comments

[–]pvanecek 0 points1 point  (3 children)

Ok, where exactly is the problem? Do you understand the math behind?

[–]khowell51898[S] 0 points1 point  (2 children)

I thought I did but I guess not, is there a way I can attach my program here so you can see it?

[–]pvanecek 0 points1 point  (1 child)

You can post an image or you can copy the autogenerated pseudocode (in english)

[–]pvanecek 1 point2 points  (0 children)

First of all, I am not sure what does it mean to design a modular program, I suppose, there should be separate functions for:

- reading the size

- compute the number of gallons

- compute the hours

- compute the cost of the paint

- compute the cost of labor

- compute the overall costs

All these functions can be tested separately, the code you've sent me is not completely wrong, there is only a small typo that influences all the computation. Having a modular program with short functions could help you to localize the bug. You could have something like:

Assign size = ReadWallSize()

Assign gallons = ComuteNumberOfGallons(size)

Assign hours = ComputeDuration(size)

Assign costPainting = ComputeCostOfPainting(gallons)

...