Question
Implement the package/class List_Package allowing for any user defined in a doubly linked list. Each entry in the list other than the head node may
Implement the package/class List_Package allowing for any user defined in a doubly linked list. Each entry in the list other than the head node may be used to store a user defined transaction. Data fields in the head node may be used or ignored by the implementer. The basic package/class definition will contain at least the following methods:
generic
type ItemsType is private;
package List_Package is
-- Methods for previous grading option
-- See sample specification/code for similar application below inCompStacg.
end List_Package followed by the body in another file
-- main program
with List_Package;
procedure MainLine is
type ItemType is ( Shoes, Kites, Jacks, Food);
currentItem: ItemType;
price: Float;
amt: Integer;
type InventoryItem is record
itemName: ItemType; unitPrice: Float; inStock: Integer;
end InventoryItem;
temp, theItem: InventoryItem;
package InventoryList is new List_Package (InventoryItem); use InventoryList;
Process the following transactions in the specified order after creating homogeneous containers for cars and planes (two separate lists). You may use the code for cars and planes used in the examples below if desired. Place the cars and planes in the correct lists.
Insert a Ford with 4 doors at the rear.
Insert a Ford with 2 doors at the front.
Insert a GMC with 2 doors at the rear.
Insert a RAM with 2 doors at the rear.
Insert a Chevy with 3 doors at the front.
Print the number of items in the list.
Print the contents of the list (front to rear).
Find and delete the first Ford in the list (search front to rear).
Print the number of items in the list.
Print the contents of the list (front to rear).
Insert a plane with 3 doors and 6 engines by Boeing at the front.
Insert a plane with 2 doors and 1 engines by Piper at the front.
Insert a plane with 4 doors and 4 engines by Cessna at the front.
Print the list.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started