A parcel application uses the following class rules. All charges are in dollars, and no taxes or other fees apply.
Each row represents a different object. Every reference in the list is declared as Parcel.
Object
Actual runtime class
Mass (kg)
Declared value (dollars)
North
Parcel
4
Not applicable
East
InsuredParcel
2
300
West
6
500
The application calls fee() once on each object and adds the returned amounts. An auditor instead applies the Parcel formula to every row, ignoring the actual runtime classes.
Find the application's total charge and the amount by which the auditor underestimates that total. Give both answers in dollars, to two decimal places.
Unlock full course notes by signing up
Follow one robot's charge
Two separate Robot objects, rover and scout, store their own battery charge percentages. Initially, rover has 54% charge and scout has 73% charge. The methods subtract or add the stated number of percentage points to the target robot's charge.
The following calls occur in order, and all succeed:
rover.consume(17)
Check requests before changing state
Two separate SnackDispenser objects, A and B, each hold at most 20 packets. Initially, A holds 8 packets and B holds 13 packets.
For each positive integer request, vend(k) removes exactly kkk packets if enough are available. The method load(k) adds exactly kkk packets if the resulting stock does not exceed 20. Otherwise, the request is rejected and the target object's stock stays unchanged. Neither method changes the other object.
Complete the table after each call, processing the rows from top to bottom. Enter yes or no for acceptance and exact integers for both stock counts.
Recognize the principles in a drawing application
A team describes four features of a drawing application. Match each object-oriented principle to the description that most directly illustrates it. Each description has one intended match.
Separate names from objects
In Python, Counter(n) creates a new object with its own stored count initially equal to nnn. Calling increment(k) adds kkk to that object's count. Assigning an existing object to another variable gives that variable a reference to the same object.
The following statements run in order:
Which statements about the final counts and object identities are true? Select all that apply.