Thread: Any ideas how to start??

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    2

    Angry Any ideas how to start??

    Hi all,

    I’ve been given a project in C++ and i am very desperated. I’ve only been studying C++ for a couple of months and we are up to the classes chapter now. I don't even know how to start.
    Here what it says: We are asked to create a kind of database, which utilizes a parking system of a shopping mall. The system will have reservation capabilities for customers. The program will also enable the end user to book/reserve a certain parking place for a specific car. All available parking places should be monitored with visual and/or textual information. The information required (Name,Surname,address,reg. number plates, arrival date,cost etc) has to be kept in a datebase for each customer. The menu must include a "key" by which the user can find at any time a certain car. Also we should create a database-like structure, with store capabilities of 120 different possible parking places. The program has to be able to back up all these attributes contained in the database by an option selected from the main menu. The created/saved file will be called backup.bak. The primary menu should be able to provide all the required information for the end user even the history log of his parking history in that particular parking. Once the user is logged off the system should be randomly initializes in order to place random cars in parking places. During initialization the car will be will be randomly created and randomly set in random parking places. Thereafter the menu of the program with the appropriate functions is presented.
    My questions:
    1st) What exactly means with the "kind of datebase"? 2nd) In what way the program should be monitores with visual or textual information? 3rd) How you will search if a car with specific number plates exits in your datebase? 4th) And what is that thing with the backup file?
    Have in mind that in our course we only tought functions, classes and objects. We havent tought to read/open or modify a file. This guy is asking for database... Please help me. I have to deliver this in a week from today.
    Thanx in advance.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    1. It is not a real database implementation - it is a "small set of data stored, that you can search in specific ways". For example, you have a limited number of parking spaces. This means that you can make simplifications that you couldn't do if you had an unlimited number of spaces.

    2. You should be able to "see" what spaces are available and unavailable in some way.

    3. This is dependent on how you implement your database structure - it should be fairly obvious once you've done that.

    4. You should be able to save the current database content into a (new) file - what part of that is it that you don't understand?

    If you haven't been told how to read and write files, I don't think you can achieve your goal - I would question your tutor on that requirement. I also think it's quite a lot to ask for in a week - or have you been pondering for a while, before now?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    1st) What exactly means with the "kind of datebase"?
    Most likely you are being asked to design a simple file format and store the data in a file.

    2nd) In what way the program should be monitores with visual or textual information?
    You would just simulate this, or possibly just ignore it in the code and "pretend" various scenarios in the demonstration.

    3rd) How you will search if a car with specific number plates exits in your datebase?
    It is a matter of searching an array or some other container for a matching number. If you model this right with classes, it can be pretty easy.

    4th) And what is that thing with the backup file?
    That is just the name of the file that is your database in persistent storage. You would also have the data in memory.

    We havent tought to read/open or modify a file.
    Start learning now.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    2
    Quote Originally Posted by laserlight View Post
    Most likely you are being asked to design a simple file format and store the data in a file.


    You would just simulate this, or possibly just ignore it in the code and "pretend" various scenarios in the demonstration.


    It is a matter of searching an array or some other container for a matching number. If you model this right with classes, it can be pretty easy.


    That is just the name of the file that is your database in persistent storage. You would also have the data in memory.


    Start learning now.
    So if i understand correctly i m gonna have a class for the parking places with attributes: 1) if is reserved or not 2) and the customer id for searching and then a class customer for creating the customers infos. But if this is the case where im gonna store the parking places? In an array? We have only learn one dimentional array. How this can be done? If i dont use arrays for storing the parking places and lets say i use classes, how this is gonna work?
    Thanx again.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You must start easy. Start with building one class, make sure it works, then move forward with the next.
    For your parking question, I'd suggest a class for it. It should contain all the info that is required for reserving a parking space, and of course, a flag that says if it's reserved or not. You can keep all these classes (120 of them) inside a vector and just look through that vector on your parking places and see if there's one free. It's not the most efficient method, but it's probably the easiest.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I don't know who wrote it, but I think it may have been iMalc - either way: Start by using the simplest method that solves the problem. So a linear search through an array should be a starting point here - doing more complex searches or more complex storage options is probably overkill to solve this problem in general. After all, 120 items in any form of array storage is pretty small in modern systems terms.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Project ideas.
    By Wraithan in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 04-25-2009, 03:29 PM
  2. start another program
    By lshome in forum C Programming
    Replies: 3
    Last Post: 06-24-2002, 01:48 PM
  3. Need some help with a basic tic tac toe game
    By darkshadow in forum C Programming
    Replies: 1
    Last Post: 05-12-2002, 04:21 PM
  4. Where is a good place to start?!
    By bobthefish3 in forum Game Programming
    Replies: 1
    Last Post: 10-09-2001, 11:28 AM