C# Class Supermarket.ShoppingList

A list of supermarket items and their desired quantites.
Datei anzeigen Open project: Clarksj4/Theme-Supermarket-Tycoon-World Class Usage Examples

Public Methods

Method Description
Add ( string product, int quota ) : void

// Adds the given product to the shopping list or increases its quota if already present

CheckOff ( int amount ) : bool

Marks the given amount as obtained for the current item of interest on this shopping list.

Next ( ) : bool

Sets the current item of interest to be the next available item in the list (cyclical). Returns false if all items have had their quota reached or have been marked as 'Pass'.

ShoppingList ( ) : System.Collections.Specialized

Method Details

Add() public method

// Adds the given product to the shopping list or increases its quota if already present
public Add ( string product, int quota ) : void
product string The product to add to the shopping list
quota int The required amount of product
return void

CheckOff() public method

Marks the given amount as obtained for the current item of interest on this shopping list.
public CheckOff ( int amount ) : bool
amount int The amount to mark as obtained
return bool

Next() public method

Sets the current item of interest to be the next available item in the list (cyclical). Returns false if all items have had their quota reached or have been marked as 'Pass'.
public Next ( ) : bool
return bool

ShoppingList() public method

public ShoppingList ( ) : System.Collections.Specialized
return System.Collections.Specialized