to calculate parking for three different vehicle..

This is a discussion on to calculate parking for three different vehicle.. within the C++ Programming forums, part of the General Programming Boards category; you are required to develop a program to calculate parking charges. each vehicles will be charged with minimum fee of ...

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    1

    to calculate parking for three different vehicle..

    you are required to develop a program to calculate parking charges. each vehicles will be charged with minimum fee of RM 0.50 for motorcycle, RM 1.00 for cars and RM 1.50 for lorry that park in the area up to 2 hours. the parking lot will charges additional fee after 2 hours parking.
    please help me how to calculate it by using c++ programming

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,590
    Announcements - General Programming Boards

    How about the first step, say
    "Input type of vehicle"
    "Input length of stay"

    Then at least we can see what you're actually capable of, and gives us some confidence that you're not out for a completely free ride (which is how it looks at the moment).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,307
    Quote Originally Posted by leo240791 View Post
    you are required to ...
    Good morning to you too!
    NEXT!
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    Registered User
    Join Date
    Dec 2012
    Posts
    1
    hai, i'm leo240791..my account cannot be open..so, i made a new one..i really do not understand how to write it..please give me an example..

  5. #5
    Registered User
    Join Date
    Jun 2011
    Posts
    2,434
    It would be difficult to give you an example that cannot be quickly hacked to meet your requirements - in other words, providing an example would likely be too close to just giving you a solution, and that we will not do.

    Write what you can so far, and post the code you come up with. Salem gave you a good starting point in post #2. Instead of ignoring useful advice that is not the quick-and-free solution you're looking for, work with those who are trying to help you.

    If you post code, be sure to use code tags.

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,069
    Hmmm... my first contribution to the programming forum in years...

    Here it goes...

    ...

    Quote Originally Posted by sampoo View Post
    i really do not understand how to write it..please give me an example..
    No.

    Ahh... that was exciting.


    EDIT: Ok, ok... to be a bit more verbose: This forum has a very strict homework policy. We are not here to do your work for you, we're here to guide you along when you encounter a road block in your work. Typically, a lot of people don't like assisting others in doing their class assignments. Period. This is because class assignments are meant to encourage you to read whatever literature accompanies the course and, unless it's a really bad course, the book is going to guide you to your solution. That said, there are people here that will assist you with your assignment, but you have to at least show that you can start your code to the point where you encounter a specific concept that you're struggling with. At the very least, if you don't want to post code, explain what you've read in the book and inquire about what you're not understanding.

    This was less exciting... back to not posting here for another few years.
    Last edited by SlyMaelstrom; 12-04-2012 at 10:23 AM.
    Sent from my iPadŽ

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,590
    So in the last 3 days since your first post, you've done no reading at all (books, tutorials, course notes) to even make at attempt at the most basic of programs, which is to prompt the user for some input and read a response.

    Quote Originally Posted by myself
    How about the first step, say
    "Input type of vehicle"
    "Input length of stay"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User
    Join Date
    Oct 2006
    Posts
    2,456
    I'll give you an example
    Code:
    #!/usr/bin/python
    
    motorcycle_rate = 0.50
    automobile_rate = 1.00
    lorry_rate = 1.50
    
    carType = raw_input('Enter Vehicle Type: ')
    rate = 0
    if carType == 'Motorcycle':
        rate = motorcycle_rate
    elif carType == 'Automobile':
        rate = automobile_rate
    elif carType == 'Lorry':
        rate = lorry_rate
    
    hours = int(raw_input('Number of Hours: '))
    
    # calculate the cost of parking here

  9. #9
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,069
    Quote Originally Posted by Elkvis View Post
    I'll give you an example
    Code:
    #!/usr/bin/python
    ...
    I've known professors that would give that an "A" in a C++ course without looking twice at it.
    Sent from my iPadŽ

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 04-15-2008, 01:57 PM
  2. hosting vs parking?
    By afreedboy in forum Tech Board
    Replies: 5
    Last Post: 09-28-2004, 06:17 AM
  3. Newbie Parking
    By Gamemonkey in forum Linux Programming
    Replies: 4
    Last Post: 12-29-2003, 04:23 PM
  4. Class vehicle with virtual function
    By silicon in forum C++ Programming
    Replies: 8
    Last Post: 12-24-2003, 09:42 AM
  5. Vehicle file attached.
    By RJstuff1 in forum C++ Programming
    Replies: 8
    Last Post: 09-22-2001, 01:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21