BueJ
Håber vi kan få lidt support på denne opgave!!Nedestående er udkastet til opgaven, vi har ændret i noget af det, vi har brug for nogle koder til public void sellCD, og requestCD
import java.util.*;
/**
* Abstract class Manager defines classes for managing
* customer orders for a CD, inventory and sales balance.
*
* @author J Ahlmann
* @version April 2003
*/
public abstract class Manager
{
// instance variables
protected int cdStock;
protected final double cdPrice = 149.50;
protected double total;
protected ArrayList orders = new ArrayList();
// Sub-classes should implement 2 constructors:
// 1. Takes no parameters and sets the cdStock variable
// to a fixed number.
// 2. Takes an int paramter that sets the cdStock variable.
//Mutator methods -------------------------------
/**
* Add an order object to the order list
* @param Order a
*/
abstract public void addOrder(Order a);
/**
* Add more CDs to the inventory: instance variable cdStock.
* @param int newCDs
*/
abstract public void requestCDs(int newCDs);
/**
* Register the sale of a CD:
* 1. Check if there any CDs in stock:
* if not,
* print a message to wait for new deliveries.
* else
* 1. Delete the order from the Orders list.
* 2. Add the price of a CD to the total variable.
* @param int index of the customer order in the Orders list.
*/
abstract public void sellCD(int index);
//Print methods -----------------------------------
/**
* Print a list of all registered orders:
* 1. Order number
* 2. Customer name
* 3. Customer telephone number
* in a nice readable format.
*/
abstract public void printOrders();
/**
* Print the following information:
* 1. The number of CDs in stock.
* 2. The number of registered orders
* 3. The current balance in DKR (instance variable double total)
* 4. If the number of orders is bigger than the number of CDs in stock,
* you should print a prompt for the shop assistant to order more CDs
* from the record company.
*
* All in a nice readable format...
*/
abstract public void printStatus();
}
