Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello chegg expert could you please help me in my back end program I ve made functions and I need to add those charts showing
Hello chegg expert could you please help me in my back end program Ive made functions and I need to add those charts showing in the picture could you please in the program when Ive mentioned to you use for charts to give me the propriet code in this
paapps self::getapps;
Get all apps
public static function getapps
$apps array;
$reader Reader::createFromPathappcsvr;
$readersetHeaderOffset;
$records $readergetRecords;
foreach $records as $record
$apps $record;
return $apps;
Get all apps from given category
public static function getappsbycategory $category 'ARTANDDESIGN'
$categoryapps array;
$records self::getapps;
foreach $records as $record
if $recordCategory $category
$categoryapps $record;
return $categoryapps;
Get all categories names
public static function getcategoriesname
$categoriesname array;
$records self::getapps;
foreach $records as $record
$categoriesname $recordCategory;
return arrayunique $categoriesname ;
Get average rating in given category
public static function getcategoryaveragerating $category
$returnarray array;
$records self::getapps;
$rating ;
foreach $records as $record
if $recordCategory $category
$returnarray $recordRating;
$rating $recordRating;
$rating $rating count $returnarray ;
return numberformat $rating, ;
Use for chart
Get average rating per category
public static function getallcategoriesaveragerating
$returnarray array;
$categories self::getcategoriesname;
foreach $categories as $category
$returnarray $category self::getcategoryaveragerating $category ;
return $returnarray;
Get count of given content rating
public static function getcontentratingcount $contentrating
$records self::getapps;
$count ;
foreach $records as $record
if $recordContent Rating' $contentrating
$count;
return $count;
Use for chart
Get all content rating count
public static function getcontentratingoverallcount
$returnarray array;
$contentratings array 'Everyone', 'Teen', 'Everyone 'Mature 'Adults only 'Unrated' ;
foreach $contentratings as $rating
$returnarray $rating self::getcontentratingcount $rating ;
return $returnarray;
Get count of given free and paid type
public static function getfreeandpaidcount $type
$records self::getapps;
$count ;
foreach $records as $record
if $recordType $type
$count;
return $count;
Use for chart
Get all free and paid count
public static function getfreeandpaidoverallcount
$returnarray array;
$freeandpaid array 'Free', 'Paid' ;
foreach $freeandpaid as $type
$returnarray $type self::getfreeandpaidcount $type ;
return $returnarray;
Use for chart
Get given top max size apps
public static function gettopmaxsizeapps $number
$returnarray array;
$records self::getapps;
foreach $records as $record
$returnarray $recordApp $recordSize;
arsort $returnarray ;
return arrayslice $returnarray, $number ;
Use for chart
Get given top priced apps
public static function gettoppriceapps $number
$returnarray array;
$records self::getapps;
foreach $records as $record
$returnarray $recordApp $recordPrice;
arsort $returnarray ;
return arrayslice $returnarray, $number ;
Use for chart
Get given top rating apps
public static function gettopratingapps $number
$returnarray array;
$records self::getapps;
foreach $records as $record
$returnarray $recordApp $recordRating;
arsort $returnarray ;
return arrayslice $returnarray, $number ;
Use for chart
Get given top reviewed apps
public static function gettopreviewedapps $number
$returnarray array;
$records self::getapps;
foreach $records as $record
$returnarray $recordApp $recordReviews;
arsort $returnarray ;
return arrayslice $returnarray, $number ;
rt
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