Write standalone function partyVolume() that takes accepts one argument, a string containing the name of a file.
Fantastic news! We've Found the answer you've been seeking!
Question:
- This is a standalone function, it should NOT be inside (indented within) the class. It should be listed in the module after the Volume class and without indentation.
- Note that the first line of the file will be treated differently than all the other lines. Probably the easiest way to do this is to 1) open the file, 2) call the .readline() method (no s!) which reads a single line, the initial value of the Volume, then 3) call the .readlines() method which reads the rest of the lines. Item 2) will be used to set the initial Volume and 3) will be iterated over to represent turning the volume up and down some number of time.
- Make sure you return the final Volume object.
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: