help, can somebody write this program for me? many thanks !!!!!!!!!!!

write a Pascal program that allows a person to manage their movie collection. In the full version of the assignment your program will read the initial information a file into an array of records. (For marking purposes your program must be able to use 'movies.dat' as an input file). The user can perform common list management functions, such as adding or removing movies. When the person has finished with the program, he or she can then save the updated information back to the data file and to reload the updated information later.
Each movie will be described by four fields with each field residing on a separate line (or lines in the case where there are sub-fields) in the following order:

1.
Movie name
2.
The names of the first three cast members.
3.
The genre of the movie
4.
The number of stars (the rating of the movie)



Description of the fields

1. Movie name

The name of the movie will be up to 80 characters in length.
2. Cast

The cast list will consist of the full names of three of the actors from this film. Each actor's name will appear on a separate line, both in the data file and when the collection is displayed onscreen. Each actor's name acts as a sub-field for this field but you can treat each person's name as one continuous string, e.g., you don't need separate fields for the first, middle and last name. The maximum length of the name field for each actor will be 80 characters. Thus a 1D array of strings can be used to store the cast information: the number in the brackets determine which actor is being accessed while index for a particular string determines which part of an actor's name is being accessed.


3. Genre

The genre field describes the category that the movie falls into. There will be six different categories of movies: action, drama, science fiction, comedy, horror, martial arts or 'other'. In the input file, the genre field will consist of a series of character up to fifteen characters in length.
4. Rating

This field uses a number of stars to rate each movie according to how good or bad that I thought it was1. The greater the number of stars, the better the movie. In the input file the number of stars that a movie received will be specified by an integer ranging from one to five.

1 star (It sucks): It's not the type of movie that's so bad that it's good, it's just all bad. Don't
waste your time with this one.

2 stars (Poor): Overall there were more things that I disliked than liked with this movie.
Unless there's a ticket sale it's probably one that you should avoid.

3 stars (Average): There were some things that I liked and some things that I disliked. It's one
that you may want to rent rather than buy.

4 stars (Good): This movie has some flaws but overall you'll have a great time watching it.

5 stars (A true masterpiece!): OMG! I laughed, I cried, it became a part of me. It should definitely
be nominated for an Oscar (maybe several).
The four main fields for each movie will be followed by a line of stars:
TERMINATOR 2 JUDGMENT DAY
Arnold Schwarzenegger
Linda Hamilton
Edward Furlong
Action
5
************
IT'S A WONDERFUL LIFE
James Stewart
Donna Reed
Lionel Barrymore
Drama
5
************
ROMEO AND JULIET
Leonard Whiting
Olivia Hussey
John McEnery
Drama
5
************

The lines of stars are not to be read into the array of records. It is only used to visually separate the movies in the input file.


Grading
(Bare bones) basic assignment (worth 10 marks)

* Declares a new type (e.g., 'Movie') that stores the 4 attributes of each movie.
* Declares a new type (e.g., 'MovieList') that consists of an array of 100 elements with each array element consisting of a movie.
* Declares an instance of the array.
* Initializes each field of each element of the array to the following values (Name := 'NNNNNN'; Cast (all three members are set to this value) := 'CCCCCC'; Genre :='GGGGGG'; Rating := -1').
* Displays an introduction with instructions about how the program works.
* Displays a sign off exit message to indicate to the user that he or she has exited the program.
* Implements some form of debug mode (i.e., it has a debugging variable that will display some sort of debugging message when the program is in debug mode).
* The program error checks the genre field to ensure that a proper category is entered. If another genre is entered then the program will enter 'other' as the genre.
* The program error checks the rating field to ensure that a movie receives a rating from one to five stars. If another value is entered then the program will set the rating to 3.
* The most basic list management functions are implemented:
* Your program reads the information from the input file (specified by the user) into the array. The contents of that array can be displayed onscreen with write and writeln statements. Each movie will be separated onscreen by a line of tildes '~'. When the list of movies is long, to prevent the output from scrolling off the screen your program should 'pause' the display of movies ever so often (say after displaying every 4th or 5th movie) while it waits for a response from the user to tell it to continue (e.g., 'Hit enter to continue'). The output must be displayed in a neat and legible format (try running the sample executable for an example). Finally your program must be able to write the movie list back to an output file (specified by the user). The line of stars that separated each movie in the input file must be written back to the output file. For the basic version of the assignment your program does not have to be able to re-read the list from a file that it just wrote to (that is an extra feature). Similar to previous assignments, your program has menu driven interface. The basic program should display a menu similar to the one shown below:

Movie Manager: Menu options

(d)isplay collection

(l)oad a collection from disk

(s)ave the collection to disk

(q)uit the program

For the base assignment these are the only menu functions that needs to actually work. You should add additional menu options as you implement the extra features that are listed below.

Comments

  • : write a Pascal program that allows a person to manage their movie collection. In the full version of the assignment your program will read the initial information a file into an array of records. (For marking purposes your program must be able to use 'movies.dat' as an input file). The user can perform common list management functions, such as adding or removing movies. When the person has finished with the program, he or she can then save the updated information back to the data file and to reload the updated information later.
    : Each movie will be described by four fields with each field residing on a separate line (or lines in the case where there are sub-fields) in the following order:
    :
    : 1.
    : Movie name
    : 2.
    : The names of the first three cast members.
    : 3.
    : The genre of the movie
    : 4.
    : The number of stars (the rating of the movie)
    :
    :
    :
    : Description of the fields
    :
    : 1. Movie name
    :
    : The name of the movie will be up to 80 characters in length.
    : 2. Cast
    :
    : The cast list will consist of the full names of three of the actors from this film. Each actor's name will appear on a separate line, both in the data file and when the collection is displayed onscreen. Each actor's name acts as a sub-field for this field but you can treat each person's name as one continuous string, e.g., you don't need separate fields for the first, middle and last name. The maximum length of the name field for each actor will be 80 characters. Thus a 1D array of strings can be used to store the cast information: the number in the brackets determine which actor is being accessed while index for a particular string determines which part of an actor's name is being accessed.
    :
    :
    : 3. Genre
    :
    : The genre field describes the category that the movie falls into. There will be six different categories of movies: action, drama, science fiction, comedy, horror, martial arts or 'other'. In the input file, the genre field will consist of a series of character up to fifteen characters in length.
    : 4. Rating
    :
    : This field uses a number of stars to rate each movie according to how good or bad that I thought it was1. The greater the number of stars, the better the movie. In the input file the number of stars that a movie received will be specified by an integer ranging from one to five.
    :
    : 1 star (It sucks): It's not the type of movie that's so bad that it's good, it's just all bad. Don't
    : waste your time with this one.
    :
    : 2 stars (Poor): Overall there were more things that I disliked than liked with this movie.
    : Unless there's a ticket sale it's probably one that you should avoid.
    :
    : 3 stars (Average): There were some things that I liked and some things that I disliked. It's one
    : that you may want to rent rather than buy.
    :
    : 4 stars (Good): This movie has some flaws but overall you'll have a great time watching it.
    :
    : 5 stars (A true masterpiece!): OMG! I laughed, I cried, it became a part of me. It should definitely
    : be nominated for an Oscar (maybe several).
    : The four main fields for each movie will be followed by a line of stars:
    : TERMINATOR 2 JUDGMENT DAY
    : Arnold Schwarzenegger
    : Linda Hamilton
    : Edward Furlong
    : Action
    : 5
    : ************
    : IT'S A WONDERFUL LIFE
    : James Stewart
    : Donna Reed
    : Lionel Barrymore
    : Drama
    : 5
    : ************
    : ROMEO AND JULIET
    : Leonard Whiting
    : Olivia Hussey
    : John McEnery
    : Drama
    : 5
    : ************
    :
    : The lines of stars are not to be read into the array of records. It is only used to visually separate the movies in the input file.
    :
    :
    : Grading
    : (Bare bones) basic assignment (worth 10 marks)
    :
    : * Declares a new type (e.g., 'Movie') that stores the 4 attributes of each movie.
    : * Declares a new type (e.g., 'MovieList') that consists of an array of 100 elements with each array element consisting of a movie.
    : * Declares an instance of the array.
    : * Initializes each field of each element of the array to the following values (Name := 'NNNNNN'; Cast (all three members are set to this value) := 'CCCCCC'; Genre :='GGGGGG'; Rating := -1').
    : * Displays an introduction with instructions about how the program works.
    : * Displays a sign off exit message to indicate to the user that he or she has exited the program.
    : * Implements some form of debug mode (i.e., it has a debugging variable that will display some sort of debugging message when the program is in debug mode).
    : * The program error checks the genre field to ensure that a proper category is entered. If another genre is entered then the program will enter 'other' as the genre.
    : * The program error checks the rating field to ensure that a movie receives a rating from one to five stars. If another value is entered then the program will set the rating to 3.
    : * The most basic list management functions are implemented:
    : * Your program reads the information from the input file (specified by the user) into the array. The contents of that array can be displayed onscreen with write and writeln statements. Each movie will be separated onscreen by a line of tildes '~'. When the list of movies is long, to prevent the output from scrolling off the screen your program should 'pause' the display of movies ever so often (say after displaying every 4th or 5th movie) while it waits for a response from the user to tell it to continue (e.g., 'Hit enter to continue'). The output must be displayed in a neat and legible format (try running the sample executable for an example). Finally your program must be able to write the movie list back to an output file (specified by the user). The line of stars that separated each movie in the input file must be written back to the output file. For the basic version of the assignment your program does not have to be able to re-read the list from a file that it just wrote to (that is an extra feature). Similar to previous assignments, your program has menu driven interface. The basic program should display a menu similar to the one shown below:
    :
    : Movie Manager: Menu options
    :
    : (d)isplay collection
    :
    : (l)oad a collection from disk
    :
    : (s)ave the collection to disk
    :
    : (q)uit the program
    :
    : For the base assignment these are the only menu functions that needs to actually work. You should add additional menu options as you implement the extra features that are listed below.
    :
    :
    Here's a start:
    [code]
    type
    PMovie = ^TMovie;
    TMovie = object(TObject)
    Title: string;
    Actors: array[0..2] of string;
    Genre: string;
    Rating: integer;
    Next: PMovie;
    constructor Create(ATitle: string);
    constructor Load(var f: TextFile);
    procedure LoadFromFile(var f: TextFile);
    procedure SaveToFile(var f: TextFile);
    destructor Destroy; override;
    end;

    constructor TMovie.Create(ATitle: string);
    begin
    inherited Create;
    Title := ATitle;
    Next := nil;
    end;

    constructor TMovie.Load(var f: TextFile);
    begin
    Create('');
    LoadFromFile(f);
    end;

    procedure TMovie.oadFromFile(var f: TextFile);
    begin
    Readln(f, Title);
    Readln(f, Actor[0]);
    Readln(f, Actor[1]);
    Readln(f, Actor[2]);
    Readln(f, Genre);
    Readln(f, Rating);
    if not Eof(f) then
    Next := New(PMovie, Load(f))
    else
    Next := nil;
    end;

    procedure TMovie.SaveToFile(var f: TextFile);
    begin
    Writeln(f, Title);
    Writeln(f, Actor[0]);
    Writeln(f, Actor[1]);
    Writeln(f, Actor[2]);
    Writeln(f, Genre);
    Writeln(f, Rating);
    if Next <> nil then
    Next^.SaveToFile(f);
    end;

    destructor TMovie.Destroy;
    begin
    if Next <> nil then
    Dispose(Next, Destroy);
    inherited Destroy;
    end;
    [/code]
  • [b][red]This message was edited by feiji at 2006-11-29 13:46:28[/red][/b][hr]
    : : write a Pascal program that allows a person to manage their movie collection. In the full version of the assignment your program will read the initial information a file into an array of records. (For marking purposes your program must be able to use 'movies.dat' as an input file). The user can perform common list management functions, such as adding or removing movies. When the person has finished with the program, he or she can then save the updated information back to the data file and to reload the updated information later.
    : : Each movie will be described by four fields with each field residing on a separate line (or lines in the case where there are sub-fields) in the following order:
    : :
    : : 1.
    : : Movie name
    : : 2.
    : : The names of the first three cast members.
    : : 3.
    : : The genre of the movie
    : : 4.
    : : The number of stars (the rating of the movie)
    : :
    : :
    : :
    : : Description of the fields
    : :
    : : 1. Movie name
    : :
    : : The name of the movie will be up to 80 characters in length.
    : : 2. Cast
    : :
    : : The cast list will consist of the full names of three of the actors from this film. Each actor's name will appear on a separate line, both in the data file and when the collection is displayed onscreen. Each actor's name acts as a sub-field for this field but you can treat each person's name as one continuous string, e.g., you don't need separate fields for the first, middle and last name. The maximum length of the name field for each actor will be 80 characters. Thus a 1D array of strings can be used to store the cast information: the number in the brackets determine which actor is being accessed while index for a particular string determines which part of an actor's name is being accessed.
    : :
    : :
    : : 3. Genre
    : :
    : : The genre field describes the category that the movie falls into. There will be six different categories of movies: action, drama, science fiction, comedy, horror, martial arts or 'other'. In the input file, the genre field will consist of a series of character up to fifteen characters in length.
    : : 4. Rating
    : :
    : : This field uses a number of stars to rate each movie according to how good or bad that I thought it was1. The greater the number of stars, the better the movie. In the input file the number of stars that a movie received will be specified by an integer ranging from one to five.
    : :
    : : 1 star (It sucks): It's not the type of movie that's so bad that it's good, it's just all bad. Don't
    : : waste your time with this one.
    : :
    : : 2 stars (Poor): Overall there were more things that I disliked than liked with this movie.
    : : Unless there's a ticket sale it's probably one that you should avoid.
    : :
    : : 3 stars (Average): There were some things that I liked and some things that I disliked. It's one
    : : that you may want to rent rather than buy.
    : :
    : : 4 stars (Good): This movie has some flaws but overall you'll have a great time watching it.
    : :
    : : 5 stars (A true masterpiece!): OMG! I laughed, I cried, it became a part of me. It should definitely
    : : be nominated for an Oscar (maybe several).
    : : The four main fields for each movie will be followed by a line of stars:
    : : TERMINATOR 2 JUDGMENT DAY
    : : Arnold Schwarzenegger
    : : Linda Hamilton
    : : Edward Furlong
    : : Action
    : : 5
    : : ************
    : : IT'S A WONDERFUL LIFE
    : : James Stewart
    : : Donna Reed
    : : Lionel Barrymore
    : : Drama
    : : 5
    : : ************
    : : ROMEO AND JULIET
    : : Leonard Whiting
    : : Olivia Hussey
    : : John McEnery
    : : Drama
    : : 5
    : : ************
    : :
    : : The lines of stars are not to be read into the array of records. It is only used to visually separate the movies in the input file.
    : :
    : :
    : : Grading
    : : (Bare bones) basic assignment (worth 10 marks)
    : :
    : : * Declares a new type (e.g., 'Movie') that stores the 4 attributes of each movie.
    : : * Declares a new type (e.g., 'MovieList') that consists of an array of 100 elements with each array element consisting of a movie.
    : : * Declares an instance of the array.
    : : * Initializes each field of each element of the array to the following values (Name := 'NNNNNN'; Cast (all three members are set to this value) := 'CCCCCC'; Genre :='GGGGGG'; Rating := -1').
    : : * Displays an introduction with instructions about how the program works.
    : : * Displays a sign off exit message to indicate to the user that he or she has exited the program.
    : : * Implements some form of debug mode (i.e., it has a debugging variable that will display some sort of debugging message when the program is in debug mode).
    : : * The program error checks the genre field to ensure that a proper category is entered. If another genre is entered then the program will enter 'other' as the genre.
    : : * The program error checks the rating field to ensure that a movie receives a rating from one to five stars. If another value is entered then the program will set the rating to 3.
    : : * The most basic list management functions are implemented:
    : : * Your program reads the information from the input file (specified by the user) into the array. The contents of that array can be displayed onscreen with write and writeln statements. Each movie will be separated onscreen by a line of tildes '~'. When the list of movies is long, to prevent the output from scrolling off the screen your program should 'pause' the display of movies ever so often (say after displaying every 4th or 5th movie) while it waits for a response from the user to tell it to continue (e.g., 'Hit enter to continue'). The output must be displayed in a neat and legible format (try running the sample executable for an example). Finally your program must be able to write the movie list back to an output file (specified by the user). The line of stars that separated each movie in the input file must be written back to the output file. For the basic version of the assignment your program does not have to be able to re-read the list from a file that it just wrote to (that is an extra feature). Similar to previous assignments, your program has menu driven interface. The basic program should display a menu similar to the one shown below:
    : :
    : : Movie Manager: Menu options
    : :
    : : (d)isplay collection
    : :
    : : (l)oad a collection from disk
    : :
    : : (s)ave the collection to disk
    : :
    : : (q)uit the program
    : :
    : : For the base assignment these are the only menu functions that needs to actually work. You should add additional menu options as you implement the extra features that are listed below.
    : :
    : :
    : Here's a start:
    : [code]
    : type
    : PMovie = ^TMovie;
    : TMovie = object(TObject)
    : Title: string;
    : Actors: array[0..2] of string;
    : Genre: string;
    : Rating: integer;
    : Next: PMovie;
    : constructor Create(ATitle: string);
    : constructor Load(var f: TextFile);
    : procedure LoadFromFile(var f: TextFile);
    : procedure SaveToFile(var f: TextFile);
    : destructor Destroy; override;
    : end;
    :
    : constructor TMovie.Create(ATitle: string);
    : begin
    : inherited Create;
    : Title := ATitle;
    : Next := nil;
    : end;
    :
    : constructor TMovie.Load(var f: TextFile);
    : begin
    : Create('');
    : LoadFromFile(f);
    : end;
    :
    : procedure TMovie.oadFromFile(var f: TextFile);
    : begin
    : Readln(f, Title);
    : Readln(f, Actor[0]);
    : Readln(f, Actor[1]);
    : Readln(f, Actor[2]);
    : Readln(f, Genre);
    : Readln(f, Rating);
    : if not Eof(f) then
    : Next := New(PMovie, Load(f))
    : else
    : Next := nil;
    : end;
    :
    : procedure TMovie.SaveToFile(var f: TextFile);
    : begin
    : Writeln(f, Title);
    : Writeln(f, Actor[0]);
    : Writeln(f, Actor[1]);
    : Writeln(f, Actor[2]);
    : Writeln(f, Genre);
    : Writeln(f, Rating);
    : if Next <> nil then
    : Next^.SaveToFile(f);
    : end;
    :
    : destructor TMovie.Destroy;
    : begin
    : if Next <> nil then
    : Dispose(Next, Destroy);
    : inherited Destroy;
    : end;
    : [/code]
    :




    hey,dude

    could you finish the work??
    coz i really need to get it done today


    thank you soooooooooooo much!!!!!!!!!!!!!!!




    here is the link :
    [[http://pages.cpsc.ucalgary.ca/~tamj/231/assignments/assignment8/index.html]]
  • : [b][red]This message was edited by feiji at 2006-11-29 13:46:28[/red][/b][hr]
    : : : write a Pascal program that allows a person to manage their movie collection. In the full version of the assignment your program will read the initial information a file into an array of records. (For marking purposes your program must be able to use 'movies.dat' as an input file). The user can perform common list management functions, such as adding or removing movies. When the person has finished with the program, he or she can then save the updated information back to the data file and to reload the updated information later.
    : : : Each movie will be described by four fields with each field residing on a separate line (or lines in the case where there are sub-fields) in the following order:
    : : :
    : : : 1.
    : : : Movie name
    : : : 2.
    : : : The names of the first three cast members.
    : : : 3.
    : : : The genre of the movie
    : : : 4.
    : : : The number of stars (the rating of the movie)
    : : :
    : : :
    : : :
    : : : Description of the fields
    : : :
    : : : 1. Movie name
    : : :
    : : : The name of the movie will be up to 80 characters in length.
    : : : 2. Cast
    : : :
    : : : The cast list will consist of the full names of three of the actors from this film. Each actor's name will appear on a separate line, both in the data file and when the collection is displayed onscreen. Each actor's name acts as a sub-field for this field but you can treat each person's name as one continuous string, e.g., you don't need separate fields for the first, middle and last name. The maximum length of the name field for each actor will be 80 characters. Thus a 1D array of strings can be used to store the cast information: the number in the brackets determine which actor is being accessed while index for a particular string determines which part of an actor's name is being accessed.
    : : :
    : : :
    : : : 3. Genre
    : : :
    : : : The genre field describes the category that the movie falls into. There will be six different categories of movies: action, drama, science fiction, comedy, horror, martial arts or 'other'. In the input file, the genre field will consist of a series of character up to fifteen characters in length.
    : : : 4. Rating
    : : :
    : : : This field uses a number of stars to rate each movie according to how good or bad that I thought it was1. The greater the number of stars, the better the movie. In the input file the number of stars that a movie received will be specified by an integer ranging from one to five.
    : : :
    : : : 1 star (It sucks): It's not the type of movie that's so bad that it's good, it's just all bad. Don't
    : : : waste your time with this one.
    : : :
    : : : 2 stars (Poor): Overall there were more things that I disliked than liked with this movie.
    : : : Unless there's a ticket sale it's probably one that you should avoid.
    : : :
    : : : 3 stars (Average): There were some things that I liked and some things that I disliked. It's one
    : : : that you may want to rent rather than buy.
    : : :
    : : : 4 stars (Good): This movie has some flaws but overall you'll have a great time watching it.
    : : :
    : : : 5 stars (A true masterpiece!): OMG! I laughed, I cried, it became a part of me. It should definitely
    : : : be nominated for an Oscar (maybe several).
    : : : The four main fields for each movie will be followed by a line of stars:
    : : : TERMINATOR 2 JUDGMENT DAY
    : : : Arnold Schwarzenegger
    : : : Linda Hamilton
    : : : Edward Furlong
    : : : Action
    : : : 5
    : : : ************
    : : : IT'S A WONDERFUL LIFE
    : : : James Stewart
    : : : Donna Reed
    : : : Lionel Barrymore
    : : : Drama
    : : : 5
    : : : ************
    : : : ROMEO AND JULIET
    : : : Leonard Whiting
    : : : Olivia Hussey
    : : : John McEnery
    : : : Drama
    : : : 5
    : : : ************
    : : :
    : : : The lines of stars are not to be read into the array of records. It is only used to visually separate the movies in the input file.
    : : :
    : : :
    : : : Grading
    : : : (Bare bones) basic assignment (worth 10 marks)
    : : :
    : : : * Declares a new type (e.g., 'Movie') that stores the 4 attributes of each movie.
    : : : * Declares a new type (e.g., 'MovieList') that consists of an array of 100 elements with each array element consisting of a movie.
    : : : * Declares an instance of the array.
    : : : * Initializes each field of each element of the array to the following values (Name := 'NNNNNN'; Cast (all three members are set to this value) := 'CCCCCC'; Genre :='GGGGGG'; Rating := -1').
    : : : * Displays an introduction with instructions about how the program works.
    : : : * Displays a sign off exit message to indicate to the user that he or she has exited the program.
    : : : * Implements some form of debug mode (i.e., it has a debugging variable that will display some sort of debugging message when the program is in debug mode).
    : : : * The program error checks the genre field to ensure that a proper category is entered. If another genre is entered then the program will enter 'other' as the genre.
    : : : * The program error checks the rating field to ensure that a movie receives a rating from one to five stars. If another value is entered then the program will set the rating to 3.
    : : : * The most basic list management functions are implemented:
    : : : * Your program reads the information from the input file (specified by the user) into the array. The contents of that array can be displayed onscreen with write and writeln statements. Each movie will be separated onscreen by a line of tildes '~'. When the list of movies is long, to prevent the output from scrolling off the screen your program should 'pause' the display of movies ever so often (say after displaying every 4th or 5th movie) while it waits for a response from the user to tell it to continue (e.g., 'Hit enter to continue'). The output must be displayed in a neat and legible format (try running the sample executable for an example). Finally your program must be able to write the movie list back to an output file (specified by the user). The line of stars that separated each movie in the input file must be written back to the output file. For the basic version of the assignment your program does not have to be able to re-read the list from a file that it just wrote to (that is an extra feature). Similar to previous assignments, your program has menu driven interface. The basic program should display a menu similar to the one shown below:
    : : :
    : : : Movie Manager: Menu options
    : : :
    : : : (d)isplay collection
    : : :
    : : : (l)oad a collection from disk
    : : :
    : : : (s)ave the collection to disk
    : : :
    : : : (q)uit the program
    : : :
    : : : For the base assignment these are the only menu functions that needs to actually work. You should add additional menu options as you implement the extra features that are listed below.
    : : :
    : : :
    : : Here's a start:
    : : [code]
    : : type
    : : PMovie = ^TMovie;
    : : TMovie = object(TObject)
    : : Title: string;
    : : Actors: array[0..2] of string;
    : : Genre: string;
    : : Rating: integer;
    : : Next: PMovie;
    : : constructor Create(ATitle: string);
    : : constructor Load(var f: TextFile);
    : : procedure LoadFromFile(var f: TextFile);
    : : procedure SaveToFile(var f: TextFile);
    : : destructor Destroy; override;
    : : end;
    : :
    : : constructor TMovie.Create(ATitle: string);
    : : begin
    : : inherited Create;
    : : Title := ATitle;
    : : Next := nil;
    : : end;
    : :
    : : constructor TMovie.Load(var f: TextFile);
    : : begin
    : : Create('');
    : : LoadFromFile(f);
    : : end;
    : :
    : : procedure TMovie.LoadFromFile(var f: TextFile);
    : : begin
    : : Readln(f, Title);
    : : Readln(f, Actor[0]);
    : : Readln(f, Actor[1]);
    : : Readln(f, Actor[2]);
    : : Readln(f, Genre);
    : : Readln(f, Rating);
    : : if not Eof(f) then
    : : Next := New(PMovie, Load(f))
    : : else
    : : Next := nil;
    : : end;
    : :
    : : procedure TMovie.SaveToFile(var f: TextFile);
    : : begin
    : : Writeln(f, Title);
    : : Writeln(f, Actor[0]);
    : : Writeln(f, Actor[1]);
    : : Writeln(f, Actor[2]);
    : : Writeln(f, Genre);
    : : Writeln(f, Rating);
    : : if Next <> nil then
    : : Next^.SaveToFile(f);
    : : end;
    : :
    : : destructor TMovie.Destroy;
    : : begin
    : : if Next <> nil then
    : : Dispose(Next, Destroy);
    : : inherited Destroy;
    : : end;
    : : [/code]
    : :
    :
    :
    :
    :
    : hey,dude
    :
    : could you finish the work??
    : coz i really need to get it done today
    :
    :
    : thank you soooooooooooo much!!!!!!!!!!!!!!!
    :
    :
    :
    :
    : here is the link :
    : [[http://pages.cpsc.ucalgary.ca/~tamj/231/assignments/assignment8/index.html]]
    :
    Here's some more methods for the TMovie object:
    [code]
    procedure TMovie.Print;
    var
    i: integer;
    begin
    writeln('Title: ', Title);
    write('Cast: ', Actors[0]);
    for i := 1 to 2 do
    if Actors[i] <> '' then
    write(', ', Actors[i]);
    writeln;
    writeln('Genre: ', Genre);
    writeln('Rating: ', Rating);
    for i := 1 to 80 do
    write('*');
    writeln;
    end;
    [/code]
    Here's the code for the movie list:
    [code]
    type
    TMovieList = object(TObject)
    private
    Head, Current, Tail: PMovie;
    procedure DoPrevious(CurrentMovie: PMovie);
    public
    constructor Create;
    function First: PMovie;
    function Next: PMovie;
    function Cursor: PMovie;
    function Previous: PMovie;
    function Last: PMovie;
    function Add(Title: string);
    function Remove(Movie: PMovie);
    procedure LoadFromFile(const Filename: string);
    procedure SaveToFile(const Filename: string);
    destructor Destroy; override;
    end;

    constructor TMovieList.Create;
    begin
    inherited Create;
    First := nil;
    Last := nil;
    end;

    procedure TMovieList.DoPrevious(CurrentMovie: PMovie);
    begin
    Current := Head;
    while Current^.Next <> CurrentMovie do
    Current := Current^.Next;
    end;

    function TMovieList.First: PMovie;
    begin
    Current := Head;
    First := Current;
    end;

    function TMovieList.Next: PMovie;
    begin
    if Current^.Next <> nil then
    begin
    Current := Current^.Next;
    Next := Current;
    end else
    Next := nil;
    end;

    function TMovieList.Cursor: PMovie;
    begin
    Cursor := Current;
    end;

    function TMovieList.Previous: PMovie;
    var
    P: PMovie;
    begin
    if Current = Head then
    Previous := nil
    else begin
    DoPrevious(Current);
    Previous := Current;
    end;
    end;

    function TMovieList.Last: PMovie;
    begin
    Current := Tail;
    end;

    function TMovieList.Add(Title: string);
    begin
    Tail^.Next := New(PMovie, Create(Title));
    Tail^.Next := Tail;
    end;

    function TMovieList.Remove(Movie: PMovie);
    begin
    DoPrevious(Movie);
    Current^.Next := Movie.^Next;
    Movie^.Next := nil;
    Dispose(Movie, Destroy);
    end;

    procedure TMovieList.LoadFromFile(const Filename: string);
    var
    f: Textfile;
    begin
    Dispose(Head, Destroy);
    Assign(f, Filename);
    Reset(f);
    Head := New(PMovie, Load(f));
    Close(f);
    end;

    procedure TMovieList.SaveToFile(const Filename: string);
    var
    f: Textfile;
    begin
    Dispose(Head, Destroy);
    Assign(f, Filename);
    Rewrite(f);
    Head.LoadFromFile(f);
    Close(f);
    end;

    destructor TMovieList.Destroy;
    begin
    Dispose(Movie, Destroy);
    inherited Destroy;
    end;
    [/code]
    I leave the user interface to you. Shouldn't be too hard.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories