Method does not work

Page 1 of 1

6 Replies - 404 Views - Last Post: 23 March 2010 - 11:30 AM Rate Topic: -----

#1 mattiboi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 02-January 10

Method does not work

Posted 21 March 2010 - 07:01 PM

OK so I tried making this first method and I can't figure out why its not working


// 
//Matt Iwan 
//CSC-236001 
// Movie Rental Program 2 
// Add A Store Summary and Rental Summary to calculate the  
// Amount Due Tax, After Discount Income and # of Customers Served 



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 MattIwanRentalStore
{
    public partial class FrmMovieRental3 : Form
    {
        public FrmMovieRental3()
        {
            InitializeComponent();


        }

        /* Proj3changes & Calculation Steps 
         *  
         * Movie Rental Amount will Now display the cost of the format when Radio Buttons are selected and add's New Release 
         *  
         * -Calculation Steps- 
         * gbRentalSummary Calculation: 
         *  
         * 1.RentalAmount[lblRentAmt] Displays Amount from format and New release(If checked) 
         * 2. Add A Total Amount from Selected Format & Movie Quantity (SubTotal) A.K.A Before Discount Cost 
         * 3.If user enters a Member #, It will check the is Member CB and Discount will apply 
         * 4.Final Cost will Be Displayed With/Without Discount 
         *  
         *     -Store Income- 
         *     5. Total customers[lblTotCost] - is determined by the Calculate Click Event| Increments per click [vCustServed] 
         *     6. Store Income[lblStoreIncome] - Lifetime view of Order income (After Discount)| Added from: [vStoreIncome] 
         */

        //Arrays 

        // Movie Name 

        //Format 

        //RentAmount 

        //Constants 
        const double CDISCOUNT = .10d;
        const double CMOVDVD = 4.50d;
        const double CMOVBD = 5.00d;
        const double CNEWRELEASE = 1.00d;
        //Variables 
        int vCustServd = 0;
        double vAmtDue = 0;
        double vStoreIncome = 0;
        double vRentalTotal = 0;
        int vMovieQuant = 0;
        double vAddNewRelease = 1.00d;
        //Project3 Variables 
        double vSubTotal = 0d;
        string txtScratch = " ";
        string so = " ";






        private void btnSubmit_Click(object sender, EventArgs e)
        {





            if (txtSearch.Text == string.Empty)
            {
                MessageBox.Show("You need to enter a movie title", "Missing Characters");

            }
            else
            {
                vMovieQuant += 1;
                lblMovieQuant.Text = vMovieQuant.ToString();
                MessageBox.Show("Request Accepted");


                txtSearch.Text = string.Empty;
            }


            //Sub Total 

            vSubTotal = vRentalTotal;

            lblSubTotal.Text = vSubTotal.ToString("C");

        }

        // ***Disabled*** 
        /* private void btnClear_Click(object sender, EventArgs e) 
         { 
 
             txtSearch.Clear(); 
             vMovieQuant -= 1; 
             lblMovieQuant.Text = vMovieQuant.ToString(); 
         } 
         */
        private void btnAbout_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Matt Iwan CSC 236-001 Movie Rental Project");
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();

        }

        private void btnCalculate_Click(object sender, EventArgs e)
        {



            //Rental Amount 
            // 1.Displays Format & New release( If Checked) Cost 






            //2. Total of Selected Movies(SubTotal) 
            // DVD || BD * MovieQuant 








            //Discount 
            lblDiscount.Text = CDISCOUNT.ToString("P");





            // Total Amount 

            vAmtDue = vRentalTotal;

            lblTotal.Text = vRentalTotal.ToString("C");


            //Store GroupBox 
            //Customers Served 
            vCustServd += 1;


            lblTotCust.Text = vCustServd.ToString();

            //Store Income 
            vStoreIncome = vRentalTotal;

            lblStoreIncome.Text = vStoreIncome.ToString("C");


        }

        private void btnSumClear_Click(object sender, EventArgs e)
        {
            lblMovieQuant.Text = null;
            lblDiscount.Text = null;
            lblRentalAmt.Text = null;
            lblTotal.Text = null;
            lblStoreIncome.Text = null;
            lblTotCust.Text = null;
            lblSubTotal.Text = null;


        }




        private double Calculate (bool BDMovietype,
                                   bool DVDMovietype,
                                   bool Member,
                                   bool NewRelease)
            
    { 
     
        
            
                        
            
BDMovietype = rbBluRay.Checked; 
DVDMovietype = rbDVD.Checked;
    
    Member = cbIsMember.Checked;
     NewRelease= cbNewRelease.Checked;

     
            
            if (DVDMovietype == true)
     {
         vRentalTotal = CMOVDVD;

          

     }

     else if (BDMovietype == true)
     {
         vRentalTotal = CMOVBD;



         


     }
     else
     {

     }

            if(Member == true)

            {
                vAmtDue = vRentalTotal * CDISCOUNT;
                vAmtDue = vRentalTotal - vAmtDue;

               
            }

            if (NewRelease == true)
            {
                vAddNewRelease = vRentalTotal += CNEWRELEASE;

               


            }

    }


        private void rbDVD_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rbDVD = (RadioButton)sender;
            return Calculate();
             lblRentalAmt.Text = CMOVDVD.ToString("C");


        }

        private void rbBluRay_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rbBluRay = (RadioButton)sender;
            return Calculate(CMOVBD);
             lblRentalAmt.Text = CMOVBD.ToString("C");

        }

        private void cbNewRelease_CheckedChanged(object sender, EventArgs e)
        {
            return Calculate(vAddNewRelease);
             lblRentalAmt.Text = vAddNewRelease.ToString("C");
        }

        private void cbIsMember_CheckedChanged(object sender, EventArgs e)
        {




            if (cbIsMember.Checked)
            {

                lblTotal.Text = vAmtDue.ToString("C");
                lblDiscount.Visible = true;
                cbIsMember.Enabled = false;

            }





        }

        private void btnOrdCom_Click(object sender, EventArgs e)
        {


            if (MessageBox.Show("Confirm", "Confirm") == DialogResult.OK)
            {
                MessageBox.Show("Thankyou");
            }





            //If btnOrdCom is clicked then cbIsMember enabled and unchecked 
            if (cbIsMember.Enabled == false)
            {
                cbIsMember.Enabled = true;
                cbIsMember.Checked = false;

                lblMovieQuant.Text = null;
                lblDiscount.Text = null;
                lblRentalAmt.Text = null;
                lblTotal.Text = null;
                lblStoreIncome.Text = null;
                lblTotCust.Text = null;
                lblSubTotal.Text = null;
                txtSearch.Text = string.Empty;
                cbNewRelease.Checked = false;
                rbDVD.Checked = false;
                rbBluRay.Checked = false;

            }

        }

        private void BtnClrNxt_Click(object sender, EventArgs e)
        {

            txtSearch.Text = string.Empty;
            cbNewRelease.Checked = false;
            rbDVD.Checked = false;
            rbBluRay.Checked = false;
        }








    }







}





Can somebody help???

Is This A Good Question/Topic? 0
  • +

Replies To: Method does not work

#2 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Method does not work

Posted 21 March 2010 - 07:21 PM

To help us help youm, could you provide a little more information. Post in a reply the actual method that is giving you a problem, any error messages you are getting, or what isn't working the way you expect it to if you are not receiving any error messages.
Was This Post Helpful? 0
  • +
  • -

#3 mattiboi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 02-January 10

Re: Method does not work

Posted 21 March 2010 - 07:27 PM

My Bad, I got a lil emo haha I forgot I didnt actually say the problem lol.... My bad

Its the Calculate Method
 private double Calculate (bool BDMovietype,
                                   bool DVDMovietype,
                                   bool Member,
                                   bool NewRelease)
            
    { 
     
        
            
                        
            
BDMovietype = rbBluRay.Checked; 
DVDMovietype = rbDVD.Checked;
    
    Member = cbIsMember.Checked;
     NewRelease= cbNewRelease.Checked;

     
            
            if (DVDMovietype == true)
     {
         vRentalTotal = CMOVDVD;

          

     }

     else if (BDMovietype == true)
     {
         vRentalTotal = CMOVBD;



         


     }
     else
     {

     }

            if(Member == true)

            {
                vAmtDue = vRentalTotal * CDISCOUNT;
                vAmtDue = vRentalTotal - vAmtDue;

               
            }

            if (NewRelease == true)
            {
                vAddNewRelease = vRentalTotal += CNEWRELEASE;

               


            }

    }


        private void rbDVD_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rbDVD = (RadioButton)sender;
            return Calculate();
             lblRentalAmt.Text = CMOVDVD.ToString("C");


        }  

Was This Post Helpful? 0
  • +
  • -

#4 Yakyb  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 21
  • Joined: 04-June 08

Re: Method does not work

Posted 23 March 2010 - 09:54 AM

what is the method trying to do?
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Method does not work

Posted 23 March 2010 - 10:29 AM

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:


  • Post the code you're having problems with (DONE)
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

Was This Post Helpful? 0
  • +
  • -

#6 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 526
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Method does not work

Posted 23 March 2010 - 10:52 AM

Calculate returns a double. You return nothing currently. So, fix that part.
Was This Post Helpful? 0
  • +
  • -

#7 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,495
  • Joined: 23-August 08

Re: Method does not work

Posted 23 March 2010 - 11:30 AM

I think this has already been fixed. The OP not only posted multiple times, he also created a second account, the reason for which he has not answered.

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1