POLC54H3 Chapter : Week9Summaries
Section 3 - Programming Questions 7. Role playing video games (RPGs) form a loosely defined genre of video games in which the player controls a small number of game characters. These characters form a group of adventurers whose purpose is to fulfill one or many quests. A common feature of RPGs is that the group of adventurers can collect various items and keep them for future me, sach items are added to the player's inventory. In this question, you will write classes which could be used to manage a player's inventory in an RPG. Part 1 Write a class called Item. An Item object represents an entire category of items carried by a group of adventurers, and each Item object has the following attributes: • The description of the items in this category (a String) The quantity of tems in this category that the group of adventurers is currently carrying can int). For example, suppose the group of adventurers is carrying 50 Heal Potions and 10 Life Potions. The SO Heal Pations would he represented by a single Item object, the value of the description attribute of this item object would be the string "Heal Potion, and the value of the quantity attribute of this Item object woukl be 50. The 10 Life Potions would also be represented by a single Item object, which is different from the Ttem object representing the Heal Potions. The value of the description attribute of this second Ttem object would he Life Potion", and the value of the quantity attribute of this second liem object would be 10. The Item class MUST provide the following INSTANCE methods, note that in the method descrip tions below, the phrase "this Item" means the item on which the method in question is called • A constructor, which takes as its only parameter a string representing the description attribute of the newly created Item. This constructor sets the quantity attribute of the newly created Item to 1. • A method called get Description(), which takes no parameters and returns a string representing the value of the description attribute of this Item • A method called getQuantity O. which takes no parameters and returns an int represent ing the value of the quantity attribute of this Item • A method called set Quantity), which takes a value of type int as its only parameter and returns nothing. This method changes the value of the quantity attribute of this Item so that its new value is equal to the int value this method accepts as parameter, this happens regardless of what the value of the int parameter is, even if it represents a sensical value Note that you MUST respect proper encapsulation practices that is, the attributes and methods of your class MUST he declared using the proper visibility modifiers. Part 2 Write a class called Inventory, which represents the inventory of a group of adventures. An Inventory object has only one attributes a collection of items, which specifies all the types of items that a group of adventurers is currently carrying along with the mumber of items of each type that the group is carrying Inventory objects MUST keep track of the items being carried by adventurers using a PLAIN ARRAY of Items, you MUST NOT se ArrayLists (or any other class which is part of the the Java Collection Framework such as Linkedin.ist) within the Inventory class under ANY circumstances. Each position in the array contains cither • The address of an Item object in memory, an Item is considered to be in the Inventory if and only if its address in memory is stored in the array . null Fach Item object in the inventory MUST appear exactly once in this array, in other words, there MUST NOT be any duplicate elements in the array under ANY circumstances, whether these dupli cates are deep copies or aliases The Inventory class MUST provide the following INSTANCE methods, note that an actual im plementation used in an RPG would provide additional methods, in particular methods to add an item to the Inventory. Also note that in the method descriptions below, the phrase "this inventory" means "the Inventory on which the method in question is called • A constructor, which takes a value of type int as its only parameter, and initializes the newly created Inventory so that the number of item types it can store is equal to the value of the parameter. The number of item types which can be stored in the Inventory is fixed during instantiation, and can never change during the lifetime of the Inventory object • A method called get.Capacity (), which takes no parameters and returns a value of type int representing the capacity of this Inventory (that is, the number of different item types which can be stored in this Inventory). • A method called getItem(), which takes a value of type int as its only parameter, and returns the Item Nered at the commenpanding position in the array holding the Items stond in this Inventory, this method returns null if the element at the position specified by the parameter value is null or if the parameter represents an invalid index in this array. • A method called consumeOne(), which takes as its only parameter a string represent ing the description of an item, and returns a value of type boolean. The method searches the inventory for an item whose description is equal to the parameter String, with the comparison being performed in a case-INSENSITIVE manner. If no such Ttem exists in the inventory, the method returns false, and the state of the Inventory does not change. On the other hand, if such an Item exist in the inventory, the method returns true and modifies the state of the Inventory as follows: -If the quantity attribute of the item is greater than or equal to 2, then its value is reduced by 1. -If the quantity attribute of the Item is equal to 1, then the item is removed from the Inventory. Note that removing an Item can be done by simply assigning null to the amay position that contains it. The state of the array before and after calling this method can consist of addresses of Item objects interspersed with null elements. For example, in an Inventory whose capacity is 20, it is possible that the array contains the addresses of Item objects al positions 3 and 17. while the other amay position contains null. This implies that the method does NOT have to "compact the array so that the addresses of all the actual tem objects appear at the beginning of the array while all the null elements appear at the end. You MAY assume that the string parameter is not null; in other words, your method does not have to handle cases in which the string parameter is indeed null Akmal notes • You MUST respect proper encapulation practices, that is the attributes and methods of your class MUST be declared using the proper visibility modifiers. • Y MUNT call the methods you were asked to write in the previous part to retrieve the descrip tion and quantity attributes of an Item object, or to change the quantity attribute of an Item object. You MAY me that the item class has been implemented correctly, even if you did not successfully complete the previous part WRITE YOUR Inventory CLASS IN THE SPACE BELOW:
DIVESTITURE IMPLEMENTATION COMMITTEE (DIC) PROJECT
The Divestiture Process
a. Listing of SOEs to be divested
The Government of Ghana provides the Divestiture Implementation Committee (DIC) with a list of enterprises slated for divestiture. DIC opens a file for each such company. All documentation and correspondence prepared or received in
connection with the enterprise is placed on this file.
Enterprises listed for divestiture are categorized by the Ministry of Finance (principally on the basis of employee numbers) into small, medium, and large. In most cases, the divestiture of large and medium enterprises is outsourced to consultants. Small enterprises are either outsourced, or divested by DIC.
Bid documents are prepared for the particular State Owned Enterprise (SOE), and the SOE is advertised for sale. Adverts should appear in at least 2 leading Ghanaian newspapers each week for 3 consecutive weeks. Adverts may also appear in foreign publications.
i. Obtaining bid documents
Investors interested in a particular SOE contact the secretariat, and after filling in an application form, paying a non-refundable bid fee (¢1,000 for local investors, and $400 for foreign investors), and signing a confidentiality undertaking, they are provided with the relevant bid documents.
The bid document is made up of
• bid procedures;
• a draft sale and purchase agreement;
• a memorandum containing the profile of the SOE;
• an independent valuation report (¢ 1,000 for local investors, and $300 for foreigners);
• fixed assets valuation report (where sale of assets is the mode of divestiture);
• share valuation report (where sale of shares is the mode of divestiture).
ii. Form of bids
Investors bids should comprise of a qualification statement made up of
1. Details about the bidder, including (as relevant):
a. the bidder's full name, address and contact details;
b. details of the bidder's directors and shareholders;
c. details of the bidder's existing business;
d. financial periods; and
2. The bidder's business plan for the enterprise, including, by way of example:
a. plans for the development of the enterprise (with regard to both its rehabilitation and, as relevant, down-sizing of expansion) and the timing of the implementation of those plan;
b. intentions with regard to employment, proposed staff training programmes and proposals for staff participation in the enterprise;
c. marketing approach and initiatives proposed for the enterprise, including export prospects and anticipated opportunities to expand beyond traditional or existing markets;
d. impact on the local community (particularly where the enterprise has traditionally provided social services and/or infrastructure);
e. impact on competition and the regulatory environment; and
f. environment impact;
3. Confirmation that the offer for the assets or, as the case may be, shares of the
enterprise is not subject to any conditions;
a. any important points of principles arising from the draft sale and purchase agreement; and
b. confirmation that the bidder will comply with the bid procedures.
c. The bid procedures must state the requisite contents of the business plan as specifically and clearly as is possible in the circumstances. The details mentioned in 3 above will not be applicable to all enterprises.
4. A price bid.
a. the price offered for the assets or, as the case may be, shares of the enterprise (clearly indicating the proposed currency of payment);
b. if the offer is not on the basis of cash in full on completion, the precise timing of any deferred payments;
c. in the event of deferred payments, details of the security proposed to be given;
d. a detailed explanation of how the bidder intends to finance the acquisition. In the case of an offer made from existing resources, the bidder will be expected to provide written confirmation from its bank or financial adviser that the necessary funds will be available.
In the case of an offer not made from existing resources, the bidder will be expected to provide written confirmation from its arrangers or providers of finance that arrangements have been made, or will be made, to provide the necessary finance; and
5. Confirmation that the bidder has not done, and will not do, at any time any of
a. communicated to a person other than DIC the amount or approximate amount of the price offered (other than in confidence to the bidder's advisers);
b. entered into any arrangement with any other person that he shall refrain from bidding or as to the amount of any price to be offered;
c. offered or agreed to pay or give, or paid or given, any valuable consideration directly or indirectly to any person for doing or having done, or causing or having caused to be done, any act or omission in relation to the price offered by the bidder or any other bid
iii. Evaluation of Bids
This is a two stage process:
• evaluation of qualification statements; and
• comparison of price bids.
DIC opens price bids from only bidders whose qualification statements DIC accepts. In the event of equal price bids, preference is given to Ghanaians.
iv. Rejection of bids :
Bids will be rejected on the following grounds:
• received after closing date and time;
• appropriate fee not paid;
• received from person who canvassed DIC member; and
• received from SOE or a body allied to an SOE.
Exceptions under which bids may be accepted include where the assets concerned comprise non-industrial land and buildings, with no on-going business, and the bidding SOE requires additional office accommodation.
DIC will write to the winning bidder, and each other bidder, to inform them of the results of the bid.
Negotiations will then start with the winning bidder. Should he fail to satisfy DIC demands, the next highest conforming bidder will be invited to negotiate.
After DIC Secretariat has agreed the terms of the sale with the winning bidder, the divestiture will be considered by the DIC members.
DIC members, if they are satisfied with the sale, will submit a letter of
recommendation to the President's Office for approval.
If either DIC or the President's Office raises concerns concerning the bid, a letter is sent to the bidder and further negotiations may take place.
If the President's Office grants the approval, DIC will send a letter to the bidder inviting him to sign the sale and purchase documentation. The Executive Secretary of DIC will sign on behalf of DIC and the government.
i. Mode of Finance
This could either be with
• investors own resource. or
• loan from a financial institution (DIC may take security over the asset until full payment is received).
In the case of instalments, for some loans, interest is paid on the diminishing balance.
ii. Terms of Payment
Payment could either be
• outright, or
• by instalments.
iii. Payment timing
• payment of less than 50% of the price offered; or
• deferred payment due 3 years after completion.
DIC prefers outright payment, but will consider deferred payment. Deferred considerations should be secured by a guarantee from a bank or other person of sufficient financial standing. If such guarantee is not available, DIC may consider taking security over the assets or, shares of the enterprise until full payment is received.
Interest on deferred payments is as follows:
• Ghanaians: relevant Ghanaian Treasury Bill Rate
• Non Ghanaians: relevant London Interbank Offer Rate plus 2%.
v. Divestiture Proceeds
This will be paid to the appropriate DIC bank account.
The Proposed System
The Board of Directors of DIC has received funding from Government of Ghana
to commission the development of a robust and user-friendly web-based system that DIC will use for its operations.
1. Discuss the system development methodology that you would adopt for this project and justify your choice.
2. Construct data flow diagrams (including a context level diagram, a level 0 diagram, and several child diagrams) that show important, representative parts of the Divestiture Implementation Committee (DIC) System.
3. Identify five data files that will be used in the Divestiture Implementation Committee (DIC) System; and construct a comprehensive Data Dictionary for each of the five data files you have identified.
4. Construct use-case diagrams, sequence diagrams, and class diagrams for the proposed Divestiture Implementation Committee (DIC) System.
5. Construct object diagrams, activity diagrams and communication diagrams for the proposed Divestiture Implementation Committee (DIC) System.
6. Design five reports that should be generated from the Divestiture Implementation Committee (DIC) System.
7. Discuss the testing strategies/techniques that you would use on this project; and provide a table of test criteria and corresponding test data for the testing.
8. Write a class called WordSet representing a set of String objects which can contain an arbitrary number of strings, limited only by the memory available to the Java Virtual Machine. A set is a collection of elements, however, unlike a list, a set cannot contain duplicate elements. Therefore, as its name implies, a WordSet object cannot contain duplicate Strings that is, if one attempts to da String to a Wordset, and the wordset already contains an element which is equal to this string, the attempt will fail and the state of the Wordset will not change. All String comparisons performed in the methods defined in the Wordset class are done in a Case SENSITIVE manner. Note that in the method descriptions below, the phrase "this Wordset" means "the Wordset on which the method in question is called." Your Wordset class MUST provide the following INSTANCE methods • A constructor, which takes no parameters and initializes the new Wordset ohject so that it contains no elements • A method called add(), which takes as its only parameter a string and returns a value of type boolean. If this Wordset already contains a string which is equal to the parameter string, or the parameter String is null, then the state of this Wordset does not change and the method return false; otherwise, the parameter String is added to this Wordset. and the method returns true. • A method called remove().which takes as its only parameter a string and returns a value of type boolean. If this wordSet contains a string which is equal to the parameter String this string is removed from the WordSet and the method returns true. On the other hand, if the string parameter is null or this Wordset does not contain a string which is equal to the parameter string, then the state of this wordset does not change, and the method return false. • A method called get.size(), which takes no parameters and returns the number of strings currently stored in this Wordset. This method MUST NOT change the state of this Wordset. • A method called isMember(). which takes as its only parameter a string and retumsa value of type boolean which is true if this wordset contains the parameter String false otherwise. If the parameter String is null, this method also return false. This method MUST NOT change the state of this wordset. • A method called computebirrerence().which takes as its only parameter a Wordset and returns a new Wordset representing the difference between this wordset and the parameter Wordset: in other words, the WordSet returned by this method contains all the strings that are in this wordset, but not in the parameter Wordset. If the parameter Wordset contains all the elements of this WordSet or this WordSet contains no elements, then this method returns a new Wordset containing no elements. Finally, if the parameter Wordset is null or contains ne strings, then this method returns a new wordset which contains all the elements of this wordset. This method MUST NOT change the state of this wordset or the parameter Wordset. • A method called tostring , which takes the parameters and turns a string which is the textual representation of this wordset. This textual representation consists of the concatena tion of the following clements - The String - The text representation of each clement in the WordSet; cach pair of adjacent clements is separated by the String", but this String MUST NOT appear before the first clement or after the last element - The String") The order in which the elements of this Wordset appear in the textual representation generated by the tostring() method does not matter. If the WordSet contains to Brings, then the textual representation returned by this method is ". Note that you MUST respect proper encapsulation practices that is, the attributes and methods of your class MUST be declared using the proper visibility modifier NINT Um an array list (of string) to keep track of the string stored in a wordt ob joot Is there a method defined in the Array loist class which determines whether in clementis already wored in an array ist, and which will do a case-sensitive comparison when liked on an Arraylint of strings? See the pages 24-26 of this examination for information about potentially useful methods defined by the ArrayList class WRITE YOUR Wordset CLASS IN THE SPACE BELOW: