olumn of the example table below). Assume, each line of values are, respectively, the width, height, and depth of a box. Write a program called box.py and add the following functions to this program. • read_file() takes a csv filename as a parameter that contains the widths, heights, and depths of all boxes. T

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Suppose a csv file contains three comma-separated values (strings) on each line (see the left
column of the example table below). Assume, each line of values are, respectively, the
width, height, and depth of a box. Write a program called box.py and add the
following functions to this program.
• read_file() takes a csv filename as a parameter that contains the widths, heights, and
depths of all boxes. This function must read the content of the file, store these values in
a 2-D list as shown in the right column of the example table below, and return this list.
All strings must be converted to integers before they are stored in the list.

Example:
csv data 2-D list
[[15, 6, 3],
[3, 7, 4],
[6, 9, 3],
[15, 6, 11],
[6, 5, 5],
[13, 10, 9],
[9, 10, 3],
[14, 5, 4],
[4, 6, 11],
[12, 10, 9]]
• Add another function called max_volume() to this program that takes this 2-D list as an
input parameter. Each item in that list contains 3 integers representing the dimensions of
a box (i.e., width, height, depth). This function must return the volume of the largest box
in the list. Note that volume = width * height * depth.
• Add a main() function that calls other functions to do the following; (i) it reads a csv
file and stores the width, height, and depth of all boxes in a 2-D list and (ii) finds the
volume of the largest box and prints it to the terminal.
• If you test your program using the sample data given above, the correct answer would be
1170. Test your program with some other sample data to ensure that it works for all inputs.

Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education