I'm bad in coding.
i need someone guide me for this assignment please.This is my assignment task
•The main objective of the project travelling agency Emmanuel Sdn.Bhd is to make avail to the customers all sorts of travelling services. A host of services such as registration, display, search, modify etc are provided.
•In the registration step, the client has to provide his personal details. In the option of display all the client information is read like name, phone, cost etc. in the search tab, if information of a particular client is required, then that be obtained.
•In the modify option, customer details can be changed or updated.
•In the delete option, record of the particular client such as his name, address and other details are deleted from the database.
•Modifications are also made to execute additional tasks. Also the project can be extended to provide number of places and availability of vehicles
How do i do this??
Create classes for these services ?
Please be patient with me as i'm really very bad in programming
design is one of the hardest things and least taught; it takes time to get there.
before making classes or anything, you have to first figure out what each thing in the requirements "is". For example, display ... sounds like a method, not a class. A class has data and methods and represents a logical chunk of code that belongs together; display sounds like it works on some other data and does a single thing, see? Likewise search sounds like a method (but if you write your own container that has a search inside it, that would be a class!).
So reading over it sounds like for the most part one major class that has display, modify, register, search, "etc" (what is THIS requirement?!) as methods. Again, if you have a helper class or two (maybe a container if you can't use STL containers?) could creep into your design, but the bulk of it would just be the 1 class.
You used the word database... do you have a real database or are you referring to your program's files as a database? If you have a real one youll need a connection and DB handler class to get that out of your way. You don't want this in a main class so if you changed the database type or whatever the other code would be reusable when you change the DB handler class.
The first thing I find is to break up the assignment into what looks like smaller pieces. This is my thought:
•The main objective of the project travelling agency Emmanuel Sdn.Bhd is to make avail to the
customers all sorts of travelling services.
A host of services such as registration, display, search, modify etc are provided.
•In the registration step, the client has to provide his personal details.
In the option of display all the client information is read like name, phone, cost etc.
in the search tab, if information of a particular client is required, then that be obtained.
•In the modify option, customer details can be changed or updated.
•In the delete option, record of the particular client such as his name, address and other details
are deleted from the database.
•Modifications are also made to execute additional tasks. Also the project can be extended to
provide number of places and availability of vehicles
How do i do this??
Create classes for these services ?
A class or struct would be useful to hold the individual information. Also an array or vector of these classes or structs would be a way to store all the different information.
This line A host of services such as registration, display, search, modify etc are provided. suggests to me a menu to drive the program. I would start by creating a function to print the menu to the screen. Personally I would use this function to print the menu and get the user input returning the answer back to where it was called from. Even if you change the menu options later it is a good place to start. Also knowing the menu options helps to let you know what other functions you will need.
Work in small pieces and you will find the program is easier to write. Along with good planning, such as how to store and work with the information you need, thee functions that you first think of. As you look at line 4 above this will give you a good ides of the function you are likely to use.
As jonnin said most of time the class definition is put in a header file and the class functions are put in a ".cpp" file. As long as you are use to working with separate files. Otherwise you could put the all of class in the main file to start with.