Ask Question

In this programming assignment, you will create a hierarchy of classes (see below) that inherit from the beverage class. The base class (Beverage) and each derived class should have the appropriate attributes, parameterized constructor, destructor, setter/getter methods, and a toString () method that clearly defines the beverage. Write a program that creates several beverages (at least one of each from list below) using a parameterized constructor and displays the set of beverages you created.

+5
Answers (1)
  1. 13 April, 19:20
    0
    public class GetInfo{

    Beverage[] beverages=new Beverage[100];

    int i=0;

    GetInfo (Beverage b) {

    beverages[i]=b;

    i++;

    }

    public void Display () {

    for (int i=0; i
    cout<
    }

    Explanation:

    we are taking Beverages array to store all values and in constructor we are adding that to the list and Display () function prints the vale
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “In this programming assignment, you will create a hierarchy of classes (see below) that inherit from the beverage class. The base class ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers