Linked Lists - Programming Assignment | CSI 1440, Assignments of Computer Science

Material Type: Assignment; Class: Introduction to Computer Science II with Laboratory; Subject: Computer Science; University: Baylor University; Term: Spring 2005;

Typology: Assignments

Pre 2010

Uploaded on 08/16/2009

koofers-user-qba
koofers-user-qba 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CIS 1440 Program 8 Due 08/05/05
Linked Lists 23:59:59
Page 1
Create a linked list of objects that represent points of interest. A header object is not
required. In addition to a “Next” pointer, each object will contain a distance (float), a
rating (1-5) and a description (char */string). The items for the points of interest will be
read from a text file, named “LinkList.txt” in the order given, with one point of interest
on each line. Read each item and add it to the end of the list until you encounter EOF.
Then print each item, in the order read, one item per line in the following format:
Points of interest in order entered
30.5, 2, Zimbabwe Falls
21.6, 5, The Brazos Belle
etc.
Next, sort the items into ascending sequence by distance and print them in the
following format:
Points of interest in order by distance
1.1, 4, Computer Science Lab
16.3, 1, Mortimer the Mighty Moose
etc.
Print a blank line between the two groups.
Your main program should be called LinkList.cpp, your class definition should be
placed in LLClasses.h, and the function implementations should be placed in
LLClasses.cpp. Your class should look something like this.
class DataItem
{
private:
float Distance;
int Rating;
char * Name;
public:
DataItem * Next;
DataItem(char * NewName,int NewRat,float NewDist);
float GetDistance();
int GetRating();
char * GetName();
DataItem();
~DataItem();
DataItem &operator=(const DataItem &Old);
DataItem(const DataItem &Old);
};

Partial preview of the text

Download Linked Lists - Programming Assignment | CSI 1440 and more Assignments Computer Science in PDF only on Docsity!

CIS 1440 Program 8 Due 08/05/ Linked Lists 23:59:

Page 1

Create a linked list of objects that represent points of interest. A header object is not required. In addition to a “Next” pointer, each object will contain a distance (float), a rating (1-5) and a description (char */string). The items for the points of interest will be read from a text file, named “LinkList.txt” in the order given, with one point of interest on each line. Read each item and add it to the end of the list until you encounter EOF. Then print each item, in the order read, one item per line in the following format:

Points of interest in order entered 30.5, 2, Zimbabwe Falls 21.6, 5, The Brazos Belle etc.

Next, sort the items into ascending sequence by distance and print them in the following format:

Points of interest in order by distance 1.1, 4, Computer Science Lab 16.3, 1, Mortimer the Mighty Moose etc.

Print a blank line between the two groups.

Your main program should be called LinkList.cpp, your class definition should be placed in LLClasses.h, and the function implementations should be placed in LLClasses.cpp. Your class should look something like this.

class DataItem { private: float Distance; int Rating; char * Name; public: DataItem * Next; DataItem(char * NewName,int NewRat,float NewDist); float GetDistance(); int GetRating(); char * GetName(); DataItem(); ~DataItem(); DataItem &operator=(const DataItem &Old); DataItem(const DataItem &Old); };