Simple Car Rental pragram

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NunYoBusiness
    New Member
    • Feb 2010
    • 5

    Simple Car Rental pragram

    I just started a C# class and our Professor is not very good at teaching much of anything. We are using the Simply C# book (2003) but are using the VB 2008 program and this weeks lab was to build a basic Car Rental app. that would multiply by $25 for each day they wanted to rent, and charge an additional $50 bucks for insurance and a 25% discount for any rentals over 5 days. The only problem is we have never really been taught how to us multiplication or the like so I am scratching my head. Any help out there would be great I am sorry if this is a super basic problem but by reading the book and what little help we get from him I am desperately lost. I can post what code I have so far if needed. Thanks in advance for any and all help.
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    The only problem is we have never really been taught how to us multiplication or the like so I am scratching my head.
    It works the same as it did in 5th grade.

    5 times 4 = 20

    int Answer = 5 * 4 ;

    Comment

    • NunYoBusiness
      New Member
      • Feb 2010
      • 5

      #3
      Thanks for the reply, I was looking for something more in depth. I am slogging through it and have gotten a little further than when I posted. But any more help would be great.

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        Originally posted by Nun
        The only problem is we have never really been taught how to us multiplication
        Originally posted by tlhintoq
        int Answer = 5 * 4 ;
        Originally posted by Nun
        Thanks for the reply, I was looking for something more in depth.
        More in depth about... Multiplication?
        Multiplication.com is the leading resource for helping kids learn the times tables and multiplication facts. Play free multiplication games, take auto-scored quizzes, drill flashcards, and access worksheets.


        How to solve word problems?
        For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.


        I think if you can make your question less vague you will get answers that are less vague.

        Comment

        • NunYoBusiness
          New Member
          • Feb 2010
          • 5

          #5
          Didn't realize I was being vague, I did state that I was looking on what was needed to have each day cost $25 (increase per number of days entered) then a 25% discount for renting for longer than 5 days. I have the program adding the $50 for insurance but I have no idea on how to get it to do the multiplication of the days or the discount here is the (I know beginning level) code I have gotten so far. Again thanks for any help in advance.

          Code:
                private void btnCalculate_Click(object sender, EventArgs e)
                {
                   // Clear text displayed in label
                   lblTotaled.Text = "";
          
                  //declare variables
                   int intTotaled = 0;
          
                   //enter data
                   if (txtName.Text == "")
                   {
                      //error condition
                      MessageBox.Show("Please  enter your name and number of days desired",
                                                    "Missing Information", MessageBoxButtons.OK,
                                                    MessageBoxIcon.Warning);
                      txtName.Focus();
                   }
                   else
                   {
                      //perform calculations
                      if (chkInsurance.Checked == true)
                      {
                         intTotaled += 50;
                      }        
                  }
                     
                  //display results
                  lblTotaled.Text = String.Format("{0:C}", intTotaled);
                 }
             }
          }
          Last edited by tlhintoq; Feb 28 '10, 09:56 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]

          Comment

          • NunYoBusiness
            New Member
            • Feb 2010
            • 5

            #6
            Sorry, I'll make sure I remember when I post code the next time.

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              Ohhh... You want someone to tell you how to translate the word problem into code. Well that's the very nature of the homework, isn't it?

              It's not a question about how to do multiplication in C#.
              It's asking for someone to figure out the logic for you.
              We can't do that. Let's be honest, if you can't convert an 8th grade word problem into a math formula or simple 3 step process... How do you plan to handle this as a career when a client asks you to build an entire system for handling a hospital, or factory?

              The best advice we can give you is "Talk to your instructor".
              I just started a C# class and our Professor is not very good at teaching much of anything.
              Then go to the dean and ask to be transfered to a different instructor's class or drop the class. I will point out that when you leave the insulated walls of acadamia that you can't just transfer to a different boss. You either learn to communicate with the people that hand out the assigned jobs or you go looking for a new employer.


              Bytes has a policy regarding assisting students with their homework.

              The short version is that the volunteers here can't help you with schoolwork.
              A) We don't know what material you have and have not learned in class.
              B) We don't know the guidelines you must follow.
              C) In the long run giving you the answers actually short changes your education.

              Hint 1: Try hitting Google with terms of your programming language and primary terms of what you want to do. For example "C# custom events" or "VB datagrid Excel". I've found this to be a very effective tool.
              Hint 2: Your text book
              Hint 3: Your instructor
              Hint 4: Posting guidelines regarding homework assignments.






              TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

              Comment

              • NunYoBusiness
                New Member
                • Feb 2010
                • 5

                #8
                I have tried my instructor and have gotten nowhere, I wasn't looking for anyone to write it for me just a little help pointing me in the right direction. I realize its very basic for experts, and I am hoping to one day be able to write above the obvious 3rd grade level I am at. I spent a long time on Google yesterday and that is how I found this site. I was thrilled to see that there were people out there who could help. I am in an evening class that meets once a week, our first week of class our homework was to read the first 5 chapters of the book, since then we have had 3 classes (one canceled due to snow) so and this week we are doing chapter 9 in the book. Maybe not breakneck speed for some people but a little fast for most of us in the class (16 students 9 lost people) the rest have had previous experience.

                Now that I have Hint #1 I will go back to Google and enter the items you suggested. Thanks for all your assistance.

                Comment

                • sashi
                  Recognized Expert Top Contributor
                  • Jun 2006
                  • 1749

                  #9
                  I just started a C# class and our Professor is not very good at teaching much of anything.
                  What a testimonial? Wonderful isn't it? You prof should be proud for having a great student like you :)

                  Comment

                  • nadeem1414
                    New Member
                    • Jul 2010
                    • 1

                    #10
                    there are lot of web site for visiting about cars but for improving and extending my cars business mostly i visited to this "web site" but now i need further more web site if do you have reply me for my business promotion.

                    Comment

                    • michaelfigura
                      New Member
                      • May 2012
                      • 1

                      #11
                      Figura does it, bitches

                      int numDays = paramNumDays;
                      int rentalCost = 25 * numDays;
                      bool isInsured = paramIsInsured;

                      if(numDays > 4)
                      {
                      rentalCost = numDays - (numDays * 25%)
                      }

                      if(isInsured)
                      {
                      rentalCost += 50;
                      }

                      //rentalCost is your output, dude!!!

                      Comment

                      Working...