1 class Box: 2 4 5 def _init__(self): self.length = 0 self.width = 0 self.height = 0 6 7 8 9 box1 = Box() 10 box1.length = int(input()) 11 box1.width = int(input()) 12 box1.height = int(input()) Your code goes here *** 13 14 box2= Box() 15 box2.length = int(input()) 16 box2.width = int (input()) 17 box2.height = int(input()) 18

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 12PE
icon
Related questions
Question

box1 and box2 are instances of the Box class. Attributes length, width, and height of both box1 and box2 are read from input. Then, two strings are read from input. In the Box class, define instance method print_measurements() with self and one string as parameters to output the string parameter in one line, and the following in the next line:

  • The value of attribute length
  • ' by '
  • The value of attribute width
  • ' by '
  • The value of attribute height
1 class Box:
2
4
5
def _init__(self):
self.length = 0
self.width = 0
self.height = 0
6
7
8
9 box1 = Box()
10 box1.length = int(input())
11 box1.width = int(input())
12 box1.height = int(input())
Your code goes here ***
13
14 box2= Box()
15 box2.length = int(input())
16 box2.width = int (input())
17 box2.height = int(input())
18
Transcribed Image Text:1 class Box: 2 4 5 def _init__(self): self.length = 0 self.width = 0 self.height = 0 6 7 8 9 box1 = Box() 10 box1.length = int(input()) 11 box1.width = int(input()) 12 box1.height = int(input()) Your code goes here *** 13 14 box2= Box() 15 box2.length = int(input()) 16 box2.width = int (input()) 17 box2.height = int(input()) 18
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT