Assignment help

What's missing in this Visual C# code to make this program run?  This is a C# class assignment and I am very new to this.  Assistance is greatly appreciated.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Lab06
{
    public partial class frmHospCharges : Form
    {

        public frmHospCharges()
        {
            InitializeComponent();
        }

        private void frmHospCharges_Load(object sender, EventArgs e)
        {

        }

        private void btnCalculate_Click(object sender, EventArgs e)
        {
            // declare variables

            decimal calcStayCharges;
            decimal calcMiscCharges;
            decimal calcTotalCharges;
        }

       
        // calcStayCharges method receives two arguments and returns a value

        private decimal calcStayCharges(int days, decimal bse)
        {
            return days * bse;
        }

       
        // calcMiscCharges method receives four arguments and returns a value

        private decimal calcMiscCharges(decimal med, decimal surg, decimal lab, decimal rehab)
        {
            return med + surg + lab + rehab;
        }

       
        // calcTotalCharges method receives four arguments and returns a value

        private decimal calcTotalCharges(int days, decimal bse, decimal med, decimal surg, decimal lab, decimal rehab)
        {
            return (days * bse) + med + surg + lab + rehab;
        }
    }
}

Open in new window

frmHospCharges.png
rtod2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mez4343Commented:
<<What's missing in this Visual C# code to make this program run?  >>
Nothing.

In Visual Studio tool, just click F5 key to Run your windows application. F10 will step into the first line of code and then F10 again will run 1 line at a time.

0
rtod2Author Commented:
Mez,
Thank you, sir!

What I meant was, what is causing it not to run when you click calculate.  Here is the complete Visual Studio project.
0
rtod2Author Commented:
Oops..  Here is the link.
0
Mez4343Commented:
ahh ha! First thing to learn about programming is asking the most specific question possible.

Problem: When I click the Calculate button the calculated charges do not display in the result textboxes.

Solution: Verify that the event handler of the Calcuate button (btnCalcuate_Click()) is calling the needed functions to calculate StayCharges.

For example,
private void btnCalculate_Click(object sender, EventArgs e)
        {
            // declare variables

            decimal calcStayCharges;
            decimal calcMiscCharges;
            decimal calcTotalCharges;

            //call StayCharges
            int days = 5
            decimal bse = 59.99

            decimal stayCharges = calcStayCharges(days,bse);
            MessageBox.Show(stayCharges);
        }

       
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
käµfm³d 👽Commented:
Take a look at your button click handler:

private void btnCalculate_Click(object sender, EventArgs e)
{
    // declare variables

    decimal calcStayCharges;
    decimal calcMiscCharges;
    decimal calcTotalCharges;
}

Open in new window


All it does is declare a few variables. Why not have it call some of those nifty calculate functions you wrote  = )
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.