THis is my assignment question...

MyCar Sdn. Bhd. sells new cars. The manager of MyCar wants to develop a system that can do storing, searching, modifying, deleting and printing all information of all selling cars by the company. As a programmer, you are required to develop a system that can do all the operations stated. All the cars information must be stored in a form of binary search tree.

The declaration of nodes for binary search tree that stores data of ‘char’ type is as follows:-

typedef char ItemType;
struct TreeNode
{
    ItemType info;
    TreeNode* left;
    TreeNode* right;
}

Modify the declaration so that the nodes in binary search tree stores these information:-

i)  Model of the cars
ii) Colour Type
iii)    Price
iv) Deposit
v)  Pointer to left child
vi) Pointer to right child

A sample of data that can be used is as follows:-

Model   Colour Type Price (RM)  Deposit (RM)
Iswara 1.3  Solid   33,235.04   3300.00
Iswara 1.5  Metallic    34,299.67   3400.00
Wira 1.5    Metallic    51,966.00   5100.00
Wira 1.5 (A/B)  Metallic    50,302.00   5000.00
Wira 1.6 (M)    Metallic    59,036.00   5900.00
Wira 1.6 (A)    Metallic    62,888.00   6200.00
Gen2 (M)    Metallic    54,475.00   5400.00
Gen2 (A)    Metallic    57,551.00   5700.00
Satria 1.3 (M)  Solid   41,094.00   4100.00
Arena 1.5   Metallic    37,250.00   3700.00
Perdana V6  Metallic    98,961.00   9800.00

Develop a program that can read the data above from a file and store them in a form of binary search tree. The data must be sorted based on the model of the car. The program must be able to perform the following functions:-

i)  InsertItem(ItemType) – To insert cars information into the tree based on model of car
ii) DeleteItem(ItemType) - To delete information from the tree based on model of car
iii)    PrintTree() - To display all the information inside the tree
iv) RetrieveItem() - To search and display information based on model of car

Provide menu to select the operations above – (Add, Delete, Search and Display)

Edited 3 Years Ago by mike_2000_17: Fixed formatting

And your question is?

my lecturer say use C++ to write out this program o...that is my assignment question. sorry make troublesome

This article has been dead for over six months. Start a new discussion instead.