Class Advertising


  • public class Advertising
    extends Object
    A data object encapsulating an advertising letter. This simple data object holds all articles and a reference to the customer.

    This class has a very bad design, but should be sufficient for demo purposes.

    Author:
    Thomas Morgner
    • Constructor Detail

      • Advertising

        public Advertising​(Customer customer,
                           Date date,
                           String adNumber)
        Creates a new advertising for the given customer, which is valid for the given date and has the specified identity number.
        Parameters:
        customer - a reference to an customer
        date - the date
        adNumber - the advertising id-number.
    • Method Detail

      • addArticle

        public void addArticle​(Article article,
                               double reduced)
        Adds an article with an reduced price to the advertising.
        Parameters:
        article - the reference to the article.
        reduced - the reduced price.
      • removeArticle

        public void removeArticle​(Article article)
        Removes the article from this advertising.
        Parameters:
        article - the article.
      • getArticle

        public Article getArticle​(int index)
        Returns the article at the given index.
        Parameters:
        index - the index.
        Returns:
        the article.
      • getArticleReducedPrice

        public double getArticleReducedPrice​(int index)
        Returns the reduced price for the article at the given index.
        Parameters:
        index - the index of the article
        Returns:
        the reduced price of the article.
      • getArticleCount

        public int getArticleCount()
        Returns the number of articles in this ad.
        Returns:
        the article count.
      • getCustomer

        public Customer getCustomer()
        Returns the customer assigned to the ad.
        Returns:
        the customer.
      • getDate

        public Date getDate()
        Returns the date, when this ad was issued.
        Returns:
        the date of this ad.
      • getAdNumber

        public String getAdNumber()
        Returns the ad number.
        Returns:
        the ad number.