can someone please help me with this program?Im so confused i dont even know where to start. My program is a bit complicated.Im suppose to create two classes.The first class is called Auto with the following
ChassisNum: int
Make: string
Model: string
Type: string
NextAuto: Auto
In the next class I'm supposed to name it ListOfAutos.This class should be used to create a linked list object.The list node should store multiple data items. The nodes in the
linked list should be of type Auto.it should have addAuto to insert at the front of a link list ,Display which should display all the nodes in the list and
CountList which should return the number of nodes in the list.
This is what is in my auto.h file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#ifndef AUTO_H
#define AUTO_H
#include <iostream>
#include<string.h>
using namespace std;
template< typename Auto > class ListOfAutos;
template< typename Auto>
class Autos
{
friend class ListOfAutos< Auto >; // make List a friend
public:
Autos( const Auto & ); // constructor
int chassisNum;
string model;
string make;
string type;
Auto getData(int chassisNum) const;
Auto getData(string model)const;
Auto getData(string make)const;
Auto getData(string type)const;
private:
Auto data; // data
Autos< Auto > *nextPtr; // next node in list
}; // end class ListNode
#endif // AUTO_H
|
im not sure if im implementing these right
Auto getData(int chassisNum) const;
Auto getData(string model)const;
Auto getData(string make)const;
Auto getData(string type)const;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
this was my auto.cpp
#include<iostream>
#include<auto.h>
template< typename NODETYPE>
Autos< NODETYPE >::Autos( const NODETYPE &info )
: data( info ), nextPtr( 0 )
{
// empty body
} // end ListNode constructor
template< typename Auto >
Auto Autos< Auto>::getData() const
{
return data;
} // end function getData
|
i haven't gotten the listofautos class as yet either but I want to make sure that I get the auto class first.