当前位置:天才代写 > 其他代写 > 留学生代写题目:“B” Option – Hint: Appendix 1,2, 3. Appendix 6 is helpful if you need to pass functions or operator overloads.

留学生代写题目:“B” Option – Hint: Appendix 1,2, 3. Appendix 6 is helpful if you need to pass functions or operator overloads.

2017-11-03 08:00 星期五 所属: 其他代写 浏览:754

“B” Option –
Hint: Appendix 1,2, 3.  Appendix 6 is helpful if you need to pass functions or operator overloads.
 
Write a generic/template package/class List_Package allowing the user the ability to store any programmer defined type in a doubly linked list with the operations defined in the “C” option.  Use a list head.  You will probably wish to provide an overload for the “=” operator as a generic parameter.  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.
 
Hint:  You do not need the “abstract stack (inheritance from a common ancestor) to create the car and plane types in appendix 5.  You may use my code for cars and planes in your code.
 
 
 “A” Option: Heterogeneous Container using Inheritance (maximum grade is 95).  Appendix 6 is helpful if you need to pass functions or operator overloads.
 
Hint: Appendix 1,4 and 5 for all “A” Options.
You need not do the “B” options.  Rather implement a single package/class using inheritance to allow multiple data types/objects in a heterogeneous list.  Use this package/class to implement a single doubly linked list and process all “B” Option transactions placing the cars and planes in a single container (list).
A sample list with one plane and one car follows:
 
 

    Head                    
    2       Plane       Car    
                         

 



An example of the empty list follows:
                         Head

    0      
           
           

 

 

    关键字:

天才代写-代写联系方式