Question: asap please, java programming Consider the class Toy. It has the attributes age_target (int), color (String) and price (double) Write the getter and setter methods
Consider the class Toy. It has the attributes age_target (int), color (String) and price (double) Write the getter and setter methods for the attribute price. Write a method selective that receives two file names and does the following: public int selective (String inputfileName, String outputFileName) 1. opens the input file for reading and the output file for writing 2. reads until the end of the input file the information of each toy, and creates a Toy object. 3. if the toy object has a target age less than 5, it is written to the output file using its toString method. 4. closes the output file after the reading is all done. 5. returns the number of toy objects that have a target age less than 5 Sample input file: 3 Red 200.0 5 Green 300.0 10 Black 500.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
