Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Appalachian Dact ofC Itin ution Problem Statement Design and build a program to

ID: 3746466 • Letter: A

Question

Appalachian Dact ofC Itin ution Problem Statement Design and build a program to estimate the gallons of paint needed to paint a wall and the estimated cost of the paint. Assume that one gallon of paint will cover 350 square feet of a wall, cach doorway accounts for 14 square feet, and each window accounts for 8.5 square feet. Obtain all other required information from the user. The output of your program must include the total cost to purchase the paint and the number of gallons needed. Additional output may include the square footage of the wall and allowances made. Appalachían

Explanation / Answer

ScreenShot

-------------------------------------

Program

using System;
using System.Windows.Forms;

namespace WallPaintEstimator
{
    public partial class FrmPaintCostEstimator : Form
    {
        //Functions
        //Wall length getting function
        public double GetWallLength()
        {
            txtWallLength.Enabled = false;
            return double.Parse(txtWallLength.Text);
        }
          
      
        //Wall width getting function
        public double GetWallWidth()
        {

             txtWallWidth.Enabled = false;
              return double.Parse(txtWallWidth.Text);

        }
        //Get Wall Are
        public double getWallArea(double length,double width)
        {
            return (length * width);
        }
      
        //Door Count
        public int GetDoorCount()
        {
          
            txtDoorCount.Enabled = false;
            return Int32.Parse(txtDoorCount.Text);
        }
        //Calculate door allowance
        public int getDoorAllowance(int count)
        {
            return (count * 14);
        }
        //Window Count
        public int GetWindowCount()
        {
            txtWindowCount.Enabled = false;
            return Int32.Parse(txtWindowCount.Text);
        }
        //Calculate window allowance
        public double getWindowAllowance(int count)
        {
            return (count * 8.5);
        }
        //Calculate total area
        public double getTotalArea(double wArea,int dAllowance,double wAllowance)
        {
            return (wArea - (dAllowance + wAllowance));
        }
        //Calculate gallons of paint
        public double getGallonsPaint(double tArea)
        {
            return (tArea / 350);
        }
        //get paint cost
        public double GetPaintCost()
        {
            txtCost.Enabled = false;
            return double.Parse(txtCost.Text); ;
        }
        //Calculate estimated cost
        public double calculateCost(double gallon,double pCost)
        {
            return (gallon * pCost);
        }
        //Display gallons needed
        public void displayGallons(double gallon)
        {
            txtPaint.Text = gallon.ToString("F");
        }
        //Display cost
        public void displayCost(double cost)
        {
            txtEstimatedCost.Text = cost.ToString("F");
        }
        public FrmPaintCostEstimator()
        {
            InitializeComponent();
        }
        //Button click event
        private void btnCost_Click(object sender, EventArgs e)
        {
            //Variable declaration
            double wLength=0, wWidth=0,paintCost=0,totalArea=0,wallArea=0,wAllowance=0,gallonsPaint=0,costOfPaint=0;
            int windowCount=0, doorCount=0, dAllowance = 0;
            //Call functions
            wLength = GetWallLength();
            wWidth = GetWallWidth();
            wallArea=getWallArea(wLength,wWidth);
            doorCount = GetDoorCount();
            dAllowance = getDoorAllowance(doorCount);
            windowCount = GetWindowCount();
            wAllowance = getWindowAllowance(windowCount);
            totalArea = getTotalArea(wallArea, dAllowance, wAllowance);
            gallonsPaint = getGallonsPaint(totalArea);
            paintCost = GetPaintCost();
            costOfPaint = calculateCost(gallonsPaint, paintCost);
            displayGallons(gallonsPaint);
            displayCost(costOfPaint);
            //Message box to continue or not the application
            DialogResult result=MessageBox.Show("Do you want to calculate paint cost again?", "Confirmation", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                txtCost.Text = "";
                txtDoorCount.Text = "";
                txtEstimatedCost.Text = "";
                txtPaint.Text = "";
                txtWallLength.Text = "";
                txtWallWidth.Text = "";
                txtWindowCount.Text = "";
                txtWallLength.Enabled = true;
                txtWallWidth.Enabled = true;
                txtDoorCount.Enabled = true;
                txtWindowCount.Enabled = true;
                txtCost.Enabled = true;
            }
            else
            {
                this.Close();
            }
        }
    }
}

--------------------------------------------------------------

Note

Design phase , I set calculations textbox es "read only" property true.

5 Input boxes and 2 output boxes here.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote