Assignment Purpose The program simulates a database of feed grain prices and other financial information over the past 100 years. The data is loaded from CSV files into ArrayLists, and the user is...

Assignment Purpose The program simulates a database of feed grain prices and other financial information over the past 100 years. The data is loaded from CSV files into ArrayLists, and the user is able to compute several queries based on the feed grain data.
Create each of the following Java classes in separate files and in the same folder as class Main. Declare the private fields in each respective class as described below. Numerical fields are given default values of negative one (-1), and String fields are given default values of the empty String (""). • YearData year (int), population (int), nominal GDP (double), real GDP (double), events (String) Note: the GDP values are given in trillions of dollars (USD) • CommodityYear year (YearData), ArrayList • MonthAmount month number (int), month name (String), amount (double), product (Commodity) • Commodity name (String), unit (String) • CommodityGroup name (String), ArrayList • FinancialInfo group (CommodityGroup), ArrayList • Subclasses of FinancialInfo – Prices price type (String) – ExportsImports isImported (boolean), toCountry (String) – QuantitiesFed 4. Write constructors for all classes to accept values for primitive and String fields, and create ArrayList objects when a class is composed of such a field. Accessors, mutators, and other methods may be written for all fields as needed, with the following exceptions: (a) References to private, composed objects must not be changed after the composing object has been created or constructed. (b) The year and population of YearData, the amount of MonthAmount, and the name field of any class must not be changed after the object has been created or constructed. (c) Private, composed ArrayList objects must not be returned by any public-access class method. The class should instead return one or more elements from the ArrayList. 5. The YearData class will contain a second constructor which accepts two YearData references and a third paramter. The final parameter may either be a double between 0 and 1 (exclusive) or an integer year between the two YearData years. The constructor will interpolate the populations between the two YearData objects similar to the following: pop = x · pop1 + (1 − x) · pop2, where pop1 < pop2="" and="" x="" is="" between="" 0="" and="" 16.="" in="" the="" main="" method,="" create="" arraylist="" objects="" containing="" yeardata,="" commoditygroup,="" and="" financialinfo="" references.="" the="" data="" will="" be="" read="" from="" the="" csv="" files="" found="" on="" moodle.="" a="" smaller="" sample="" file="" is="" also="" provided="" for="" testing.="" individual="" rows="" of="" a="" data="" file="" may="" be="" parsed="" to="" a="" string="" array="" by="" using="" the="" string="" class="" method="" string="" []="" split(string="" regex).="" for="" example,="" string="" []="" array="in.nextLine().split(" \t");"="" 7.="" write="" then="" invoke="" the="" following="" methods="" to="" add="" elements="" to="" each="" arraylist.="" (a)="" write="" a="" static="" method="" in="" class="" main="" that="" accepts="" one="" arraylist="" of="" yeardata="" references="" named="" years.="" i.="" add="" one="" yeardata="" for="" each="" line="" of="" the="" file="" population.csv.="" the="" header="" row="" may="" be="" omitted="" by="" ignoring="" the="" first="" result="" from="" in.nextline().="" ii.="" interpolate="" the="" nine="" (9)="" intermediate="" years="" between="" the="" successive="" population="" data="" in="" years,="" and="" add="" new="" yeardata="" objects.="" for="" instance,="" take="" the="" yeardata="" objects="" for="" 1980="" and="" 1990,="" interpolate="" and="" add="" objects="" for="" the="" years="" 1981,="" 1982,="" .="" .="" .="" 1989.="" iii.="" update="" the="" nominal="" and="" real="" gdp="" values="" and="" the="" events="" of="" each="" year="" listed="" in="" gdp-history.csv.="" recall,="" these="" values="" are="" trillions="" of="" usd.="" (b)="" write="" a="" static="" method="" in="" class="" main="" that="" accepts="" one="" arraylist="" of="" commoditygroup="" references="" named="" cg="" and="" one="" arraylist="" of="" financialinfo="" references="" named="" fi.="" these="" steps="" may="" be="" further="" subdivided="" into="" static="" or="" class="" method="" as="" desired.="" i.="" read="" and="" parse="" each="" line="" of="" the="" file="" feedgrains.csv.="" continue="" executing="" the="" following="" steps="" until="" the="" end="" of="" the="" file="" is="" reached.="" ii.="" add="" an="" object="" for="" the="" current="" commoditygroup="" to="" cg="" if="" the="" group="" is="" not="" present.="" note="" that="" commoditygroups="" are="" the="" same="" if="" their="" names="" are="" equal.="" iii.="" update="" the="" appropriate="" commoditygroup="" in="" the="" arraylist="" cg="" if="" the="" current="" commodity="" has="" not="" been="" added="" to="" any="" group.="" note="" that="" commodities="" are="" the="" same="" if="" their="" names="" and="" units="" are="" both="" equal.="" iv.="" add="" an="" object="" for="" the="" current="" financialinfo="" to="" fi="" if="" not="" present="" based="" on="" commoditygroup="" and="" the="" string="" value="" financialinfo="" (e.g.,="" prices)="" which="" are="" also="" the="" subclass="" names.="" remember="" to="" create="" the="" object="" with="" the="" appropriate="" subclass="" constructor.="" v.="" update="" the="" appropriate="" financialinfo="" element="" in="" the="" arraylist="" fi="" with="" the="" current="" commodityyear="" (if="" not="" present).="" vi.="" create="" a="" monthamount="" object="" with="" the="" current="" information="" and="" update="" the="" appropriate="" commodityyear.="" 8.="" create="" a="" menu="" system="" in="" the="" main="" method="" allowing="" the="" user="" to="" perform="" some="" of="" the="" following="" operations.="" choose="" at="" least="" (15)="" of="" the="" following="" options="" with="" at="" least="" two="" from="" each="" list.="" the="" user="" will="" specify="" a="" year="" by="" typing="" the="" number="" given="" a="" range="" of="" valid="" years.="" other="" input="" may="" be="" prompted="" in="" a="" manner="" chosen="" by="" the="" student.population="" and="" gdp="" information="" (a)="" find="" the="" population="" for="" a="" given="" year="" (b)="" find="" the="" nominal="" and="" real="" gdp="" for="" a="" given="" year="" (c)="" find="" the="" two="" years="" when="" the="" largest="" percentage="" increase="" (i.e.,="" (pop2−pop1)/pop1)="" in="" population="" occurred="" (d)="" find="" the="" two="" years="" when="" the="" largest="" percentage="" increase="" in="" nominal="" gdp="" occurred="" (e)="" find="" the="" events="" for="" the="" three="" years="" prior="" to="" the="" year="" in="" which="" the="" smallest="" percentage="" increase="" in="" population="" occurred="" (f)="" find="" the="" events="" for="" the="" three="" years="" prior="" to="" the="" year="" in="" which="" the="" smallest="" percentage="" increase="" in="" nominal="" gdp="" occurred="" commodities="" and="" commodity="" groups="" (a)="" print="" a="" list="" of="" all="" commodity="" groups="" along="" with="" the="" number="" of="" commodities="" in="" each="" group="" (b)="" print="" a="" list="" of="" all="" commodities="" in="" a="" group="" given="" by="" the="" user.="" include="" both="" the="" name="" and="" the="" unit="" in="" the="" list.="" (c)="" print="" a="" list="" of="" all="" commodity="" names="" in="" a="" group="" given="" by="" the="" user.="" in="" the="" printout,="" combine="" commodities="" with="" different="" units="" while="" also="" printing="" a="" count="" of="" the="" number="" of="" units="" for="" each="" name.="" commodity="" price="" information="" note:="" when="" aggregating="" and="" comparing="" costs,="" it="" is="" allowable="" to="" combine="" different="" units.="" (a)="" print="" a="" list="" of="" all="" price="" financial="" information="" including="" the="" commoditygroup="" name,="" price="" type,="" and="" year="" range="" (minimum="" and="" maximum)="" for="" that="" type.="" (b)="" find="" the="" average="" price="" of="" a="" given="" commoditygroup="" name,="" price="" type,="" and="" year="" (each="" specified="" by="" the="" user).="" (c)="" find="" the="" year="" with="" the="" largest="" average="" price="" for="" a="" given="" commodity="" group="" (specified="" by="" the="" user).="" also="" include="" the="" commodity="" name="" within="" that="" commodity="" group="" with="" the="" largest="" price.="" consider="" all="" price="" types="" in="" this="" search.="" (d)="" find="" the="" month="" with="" the="" largest="" price="" for="" a="" given="" commodity="" group="" for="" a="" given="" year="" (both="" specified="" by="" the="" user).="" also="" include="" the="" commodity="" name="" within="" that="" commodity="" group="" with="" the="" largest="" price.="" consider="" all="" price="" types="" in="" this="" search.="" (e)="" find="" the="" month="" with="" the="" largest="" price="" for="" a="" given="" commodity="" group="" (specified="" by="" the="" user)="" over="" all="" years.="" consider="" all="" price="" types="" in="" this="" search.="" hint:="" average="" the="" month="" number="" of="" each="" year’s="" highest="" month="" while="" taking="" into="" account="" the="" december-january="" transition.="" commodity="" import="" export="" information="" (a)="" find="" the="" total="" amount="" of="" imports="" of="" a="" given="" commodity="" group="" for="" a="" given="" year="" (both="" specified="" by="" the="" user).="" (b)="" find="" the="" total="" amount="" of="" exports="" of="" a="" given="" commodity="" group="" for="" a="" given="" year="" (both="" specified="" by="" the="" user).(c)="" find="" the="" most="" imported="" commodity="" within="" a="" given="" commodity="" group="" for="" a="" given="" year="" (both="" specified="" by="" the="" user).="" (d)="" find="" the="" most="" exported="" commodity="" within="" a="" given="" commodity="" group="" for="" a="" given="" year="" (both="" specified="" by="" the="" user).="" commodity="" quantities="" fed="" information="" (a)="" calculate="" the="" total="" cost="" of="" using="" a="" given="" commodity="" as="" feed="" for="" a="" given="" year="" (both="" specified="" by="" the="" user).="" use="" the="" individual="" monthly="" amounts="" of="" the="" quantities="" fed="" and="" the="" relevant="" commodity.="" (b)="" calculate="" the="" proportion="" that="" a="" given="" commodity="" was="" used="" as="" feed="" in="" a="" given="" year="" (both="" specified="" by="" the="" user)="" in="" relation="" to="" its="" commodity="" group.="" (c)="" calculate="" the="" proportion="" that="" a="" given="" commodity="" was="" used="" as="" feed="" in="" a="" given="" year="" (both="" specified="" by="" the="" user)="" in="" relation="" to="" all="" commodities="" for="" that="" year.="" (d)="" calculate="" the="" total="" cost="" of="" using="" all="" commodities="" in="" a="" given="" commodity="" group="" as="" feed="" for="" a="" given="" year="" (both="" specified="" by="" the="" user).="" print="" the="" result="" as="" the="" percentage="" of="" real="" gdp="" for="" that="" year.="" recall="" that="" gdp="" is="" given="" in="" trillions="" of="" dollars="" (usd).="" (e)="" calculate="" the="" proportion="" a="" given="" commodity="" (specified="" by="" the="" user)="" contributed="" to="" the="" total="" cost="" of="" using="" the="" commodity="" group="" as="" feed="" for="" a="" given="" year.="" additional="" requirements="" the="" following="" coding="" and="" implementation="" details="" must="" be="" present="" in="" your="" solution="" to="" receive="" full="" credit="" for="" programming="" assignment="" #5.="" 1.="" a="" reference="" variable="" and="" instance="" object="" of="" class="" java.util.scanner="" must="" be="" used="" to="" read="" the="" input="" from="" the="" user.="" 2.="" identifiers="" must="" be="" descriptive="" (i.e.,="" must="" self="" document).="" 3.="" indention="" of="" all="" code="" blocks="" (compound="" statements,="" code="" inside="" braces),="" including="" single="" statements="" following="" selection="" or="" iterative="" statements,="" is="" required.="">



Dec 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here