A. Dummy Data Generation Refer to Appendix 1: Entity-Relationship Diagram for the database schema; Appendix 2: Sample Da
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
A. Dummy Data Generation Refer to Appendix 1: Entity-Relationship Diagram for the database schema; Appendix 2: Sample Da
B. Dummy Farmers Simulation Simulate farmers (users) activity logging in multiple threads. Farmers are part of the Users data schema. Refer to Appendix 1: Entity-Relationship Diagram for the database schema; Appendix 2: Sample Data for the sample data for each table; and Appendix 3: Data Constraints and Definitions for rules of data. 1. Implement the class Farmer Simulator that implements the interface below: interface Farmer Simulator Interface { []Farmer generate Farmers(int numberOfFarmers); 2. Implement the class Farmer that extends Thread or implements Runnable. In the run() method, the Farmer object generates at least 1000 activities of random activity types for a single random farm. For example, Farmer A generates 1234 activities of random types for Farm A. 3. Write the farmers' sent operations and success operations into log file(s). Make sure that the correctness of your application is traceable and clearly shown as logs. Ac Go
Appendix 1: Entity-Relationship Diagram Plants pk _id String name String unitType String Users Farms pk id String pk _id String Fertilizers tk farms String tk plants String pk id String name String fk fertilizers String name String ema String fk pesticides String unitType String password String name String phoneNumber String address String Pesticide pk id String name String unitType String Activities pk _id string Tk farmid String Tk userid String date String action String type String unit String quantity Double field Integer row Integer А. G
Business Rules: 1. Each user must be associated with at least 1 farm and each farm can be associated with O or more users. 2. Each user can create multiple activities and each activity must be created by one and only one user. 3. Each farm must be associated with at least 1 plant and each plant can be associated with 0 or more farms. 4. Each farm must be associated with at least 1 fertilizer and each fertilizer can be associated with 0 or more farms. 5. Each farm must be associated with at least 1 pesticide and each pesticide can be associated with 0 or more farms. 6. Each farm must be associated with at least 1 activity and each activity must be associated with 1 farm. Activ Go to
Appendix 2: Sample Data Farms _id name address fertilizers pesticides Oak Wood Farm plants ["1","2","4","5","6" "7","8") 1 838, Dayton Point ["3","4","6"] ["1","6") 2 Pinewood Farm 1285, Roosevelt Street ("1","3", "5","6","7" ["1", "2"] ["1","3","7"] Users _id name email password phone Number farms 1 Vail Cussons [email protected] RL RFF053akr 012-2045723 ["1","2") 2 Amalee Carthur [email protected] SixWqjMrGW 011-10237932 ["2") 3 Richard Reagus [email protected] ShrfiUwoolji 017-59298049 ["1") 4 Whitby Flintiff [email protected] OiWxfJeaezu 012-74350295 ["1"] Plants _id name unitType 1 Pansies mass 2 mass Winter melon Welsh onion 3 mass 4 Pumkin mass 5 5 Mizuna mass 6 Fennel mass 7 Leek mass 8 Radish mass
Fertilizers id name unitType 1 GROBEL NPK 4-3-3+1 Mgo pack 2 pack 3 Activit 4-3-2 Fertiplus 4-2-10 Nutri Smart Active Eco-Fertilizer pack 4 pack 5 pack 6 BG Soil Grobel NPK 4-3-3 +1 Mgo Greenferti 4-3-3-1 pack 7 pack 8 MixOʻPlus pack Pesticides id name unitType 1 Xen Tari mass 2 Enspray 99 mass 3 4 5 Trilogy mass Evergreen Pyrethrum Concentrate mass Agree® WG Biological Insecticide BIOBAC Y1336 WP Kingbo Matrine 6 mass 7 mass Activities _id 1 3 1 2 2 2 date action type unit quantity field row farmld userid 2021-12-22 sowing fennel kg 1 1 2 2 2021-12-31 harvest winter melong 500 2 1 1 3 2022-01-03 pesticide Enspray 99 2000 1 1 2 2022-01-05 fertilizer Activit 4-3-2 pack (500g) 2 1 2 1 4 2022-01-06 sales winter melon kg 10 2 1 1 3 3 ml N 4 2 4 3 5 2.
Appendix 3: Data Constraints and Definitions *All columns in all tables are not nullable. Farms Attribute _id name address plants Data Constraints and Definitions The unique identifier for each row. Start from 1 and increment by 1 for the subsequent rows. Stored as String The name of the farm. The address of the farm The_ids of the plants that the farm has. Should not contain an id that does not exist in the Plants table. • Should have at least one element. The_ids of the fertilizers that the farm has. Should not contain an id that does not exist in the Fertilizers table. Should have at least one element. The_ids of the pesticides that the farm has. • Should not contain an id that does not exist in the Pesticides table. • Should have at least one element. fertilizers pesticides Users name Attribute Data Constraints and Definitions id The unique identifier for each row. Start from 1 and increment by 1 for the subsequent rows. Stored as String The name of the user. email The email of the user. password The password of the user. phoneNumber The phone number of the user. farms The farms that the user belongs to Should not contain an id that does not exist in the Farms table. Should have at least one element.
Plants, Fertilizers & Pesticides Attribute id Data Constraints and Definitions The unique identifier for each row. Start from 1 and increment by 1 for the subsequent rows. Stored as String. The name of the plant/fertilizer/pesticide. • The type of unit used to indicate the amount of the plant/fertilizer/pesticide. • The value can be mass, pack, or volume name unitType Activities Attribute id date action Data Constraints and Definitions The unique identifier for each row. Start from 1 and increment by 1 for the subsequent rows. Stored as String The date when the activity took place. The format should be YYYY-MM-DD. The type of the activity. • The value can be sowing, fertilizers, pesticides, harvest, or sales. If the action is sowing/harvest/sales, store the plant's name. If the action is fertilizers, store the fertilizer's name. If the action is pesticides, store the pesticide's name. The unit of the type attribute. If the unitType of the item in parent table is: omass -> kg/g pack->pack (500g)pack (1000g) o volume -> t/mt type unit quantity field row The amount of the type attribute. The field number in the farm where the activity took place. The row number in the field where the activity took place. The id of the farm where the activity took place. The id of the user who records the activity. farmld userld