Question: QUESTION i.) Show how the input and output streams will be created, then call the RecordRoundGlasses(), with the two streams as parameters. ii.) Give the

QUESTION i.) Show how the input and output streams will be created, then call the RecordRoundGlasses(), with the two streams as parameters. ii.) Give the code of the RecordRoundGlasses() method.
Question #5 (5 marks) The collection of antique sunglasses is kept by an antique dealer at all times Sunglasses.txt. However, depending on the inventory, the file may include zero or many records. Each the records indicates the type of the sunglasses (round, oval, square, etc.), its year of creation and its price These values are separated by tabs (i.e. there is a tab character between each of them), We ar in tracing all round sunglasses and obtain the total value of these glasses in the inventory. Those sunglasses must be recorded in a file called RoundGlasses.txt. To be precise, t the file will include all the records of round sunglasses from Sunglasses.tor, as well as a final line that includes the total glasses (sum of all their values). You are required to give only particular parts of the code. In specific, i) you need to show how the two files (Sunglasses.txt and RoundGlasses.txr) are opened for input and output respectively, using the Scanner and PrintWriter classes. i) You are also required to write the code of a method RecordRoundGlasses and a Print Writer o which accepts two parameters, a Scanner object represent bject representing an output stream, The method must then find all records in the in the output file. A final line input file that have round glasses. These entries must then be recorded icating the total value of these glasses must be recorded at the end of the output file stored in the (RoundGlasses.txt). output file. As a requirement, when you read the records on each line. you must read each The method must guarantee upon its termination that the records are the records as a whole line then break For instance, given the following input file shown below, a call to the method will result in the creation of the output file, RoundGlasses.txt, as shown below. Notice that this is iust an example your solution must NOT be based on it, or refer to it. Sunglasses.txt Round 1936 Oval 1944 Round 1922 Round 1960 Square 1988 Rectangle 1955 230.00 Irregular 1910 1329.55 Round 1973 Round 1936 RoundGlasses.txt Round 1936 Round 1922 Round 1960 Round 1973 Round 1936 844.55 433.99 392.97 729.75 129.90 844.55 392.97 729.75 399.16 700.09 Total Value of Round Glasses: 3066.525 399.16 700.09 Here are the needed imports import java.util.Scanner import java.io.Printwriter import java.io.FileoutputStream import java.io.PileInputStream import java. io.FileNotFoundException
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
