Question: Question 4 [CLO-1] Consider the class Pen. It has a color (String) and a length (double). It has an initialization constru this class is given

 Question 4 [CLO-1] Consider the class Pen. It has a color
(String) and a length (double). It has an initialization constru this class

Question 4 [CLO-1] Consider the class Pen. It has a color (String) and a length (double). It has an initialization constru this class is given (.e. do not write the class methods). Write a method readPens(String inputFileName) that does the following: 1. opens the input file name for reading 2. Reads the the color and the length of each pen in the file 3. creates an object of type Pen and fills it with the read information 4. then displays this object using the toString() method of the class pen. 5. Handel all possible exceptions Sample input file Blue 30.5 Red 20.2 Black 25.9 For the toolbar press AUT-F1 (PC) or ALT-FN-F10 (Mac) Bg S Paragraph Arial 14px 111 Question 4 of E 4 points Save Ar length (double). It has an initialization constructor, a default constructor, setters and getters, and a toString method. Assume the following: nformation Ef the class.pen 15 A 2 3 O QS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!