The class Phone with 3 data members: id, weight and price is given and you do not need to edit it. In this s, id must be unique (there is no duplicated id in the list), weight>0, and price>0. The MyList class is a linked list of Phone objects. The following methods should be completed:
void addLast(String xld, int xWeight, int xPrice).void f1() - Do not edit this method. Your task is to complete the addLast(...) method above only.The expected output in the file f1.txt should be the following:(H,6,7) (C,4,5) (Y,5,8)
1
void f2() -There is a given Phone objects (named v) in this function. Suppose the list contains at least 3 elements. Write statements to insert v to the list such that v will be the 3rd node after insertion. The expected output in the file f2.txt should be the following:
Zoom
100%
Close