AP Computer Science A Quiz
19 questions · no time limit
0:00
CLASS CREATION
Question 1 of 19
No time limit
Current
Answered
Flagged
Not seen
PASSAGE
public class Inventory { private static int itemCount = 0; private static double totalValue = 0.0; private int quantity; private double unitPrice; public Inventory(int qty, double price) { quantity = qty; unitPrice = price; itemCount++; totalValue += quantity * unitPrice; } public void restock(int additionalQty) { quantity += additionalQty; totalValue += additionalQty * unitPrice; } public void adjustPrice(double newPrice) { totalValue = totalValue - (quantity unitPrice) + (quantity newPrice); unitPrice = newPrice; } public static double getTotalValue() { return totalValue; } }
Which statement best describes the behavior of the Inventory class methods when multiple instances interact with the class variables?
YOUR PROGRESS
19
QUESTIONS
Ready when you are
Answer in any order. Your progress shows here as you go.
QUESTIONS
KEYBOARD
Pick an answer ABCD
Next question ↵→
Previous ←
Flag for review F