answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kumpel [21]
2 years ago
13

In this programming assignment, you will create a hierarchy of classes (see below) that inherit from the beverage class. The bas

e 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.
Computers and Technology
1 answer:
harina [27]2 years ago
5 0

Answer:

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<beverages.length;i++)

cout<<beverage[i].tostring();

}

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

You might be interested in
A company operates on two types of servers: 2 large servers (L) and 4 smaller servers (S), with a combined total of 64GB RAM. Th
kati45 [8]

Explanation:

Let the size of a large server be L, and

the size of a small server be S.

We are given two scenarios,

2L+4S = 64.............(1)

and

L+3S = 40...............(2)

We solve the equations as follows

2(2)-(1)

2L-2L +6S-4S = 2*40-64

2S = 16

so S=8 ..................(3), size of small server

substitute (3) in (2)

L+3(8) =40

L = 40-24 = 16..............size of large server

8 0
2 years ago
Assume you have a variable, budget, that is associated with a positive integer. Assume you have another variable, shopping_list,
max2010maxim [7]

Answer:

budget=455

shopping_list=("codelab", "textbook", "ipod", "cd", "bike")

prices={"codelab":300, "textbook":100,"ipod":50, "cd":10, "bike":600}

number_of_items=0

sum=0

for index in range(len(shopping_list)):

   sum=sum+prices[shopping_list[index]]

   if (sum<=budget):

       number_of_items=number_of_items+1

   else :

       break

print "number of items you can purchase, for a budget of",budget,"is",number_of_items

Explanation:

A code to determine the number of items that can be purchased is above, given the value associated with budget, and given that you will buy items in the order that they appear in the tuple associated with shopping_list.

4 0
1 year ago
Most GUIs provide all of the following except _____.
meriva

GUI stands for Graphical User Interface. It is an interface that enables users to easily interact with their computers through graphical icons and visual indicators. Most GUIs provide all of the following except command prompts . The command prompt is not graphical interface , but it is text-and-keyboard oriented.

8 0
1 year ago
Read 2 more answers
Write a program that prints the U.S. presidential election years from 1792 to present day, knowing that such elections occur eve
miv72 [106K]

Answer:

The cpp program to print US presidential years is given.

#include <iostream>

using namespace std;

int main()

{

   // variable to hold presidential election year declared  

   int elec_year;

// variable to hold presidential election year initialized to 1792  

elec_year=1792;

   

// the value displayed on the console output

   std::cout << "The U.S. presidential election years from 1792 to present day are listed. " << std::endl;

   

   // loop executes till year is less than or equals 2020

   do

   {

       // initial value is printed

       std::cout << elec_year << std::endl;

       

       // value is incremented by 4

       elec_year = elec_year + 4;

       

   }while(elec_year<=2020);

   return 0;

}

OUTPUT

The U.S. presidential election years from 1792 to present day are listed.  

1792

1796

1800

1804

1808

1812

1816

1820

1824

1828

1832

1836

1840

1844

1848

1852

1856

1860

1864

1868

1872

1876

1880

1884

1888

1892

1896

1900

1904

1908

1912

1916

1920

1924

1928

1932

1936

1940

1944

1948

1952

1956

1960

1964

1968

1972

1976

1980

1984

1988

1992

1996

2000

2004

2008

2012

2016

2020

Explanation:

The program works as described.

1. An integer variable, elec_year, is declared and initialized with the first US presidential year value, 1792.

2. Inside the do-while loop, the variable, elec_year, is first printed to the console followed by a new line inserted using, endl.

3. The variable, elec_year, is then incremented by 4.

4. The do-while loop continues till the value of the variable, elec_year, does not exceeds the current year, 2020.

5. The program ends with a return statement since main() has return type int.

6. Only one variable is used in the program.

7. The program consists of only main() method since cpp is not completely object oriented programming language.

8. The same program, if written in object oriented programming language like java or c# will be written inside a class and executed through main() method.

4 0
1 year ago
In cell B16, enter a function to calculate the total attendance for the years 2014 through 2018 using the totals in the range B1
Burka [1]

Answer:

The function to be entered in the cell B16 to calculate the total attendance for the years 2014 through 2018 is; =sum

Explanation:

In Ms. Excel the Sum function is used to calculate the totals of particular cell range. Simply type in; =sum in the cell B16 then highlight the cell range  B12:F12. Upon pressing enter, the spreadsheet will return the total attendance for the years 2014 through 2018.

3 0
1 year ago
Other questions:
  • U.S. industries like steel, computers, and energy need to be protected from foreign competition to ensure which of the following
    6·2 answers
  • Splunk uses ________ to categorize the type of data being indexed..
    11·2 answers
  • Technician A says that the octane rating of gasoline is the measure of its antiknock properties. Technician B says that normal c
    5·1 answer
  • De'Von is graduating from college and wants to create a professional development plan in order to prepare for his future. What i
    8·1 answer
  • A network design engineer has been asked to design the IP addressing scheme for a customer network. The network will use IP addr
    6·1 answer
  • The following parts were ordered by someone building a personal computer:
    12·1 answer
  • You are modeling a small part of an online flight reservation system, according to the following description. A flight is a sing
    11·1 answer
  • ___________is used for drawing 3D objects in the field of Science and Engineering.
    12·2 answers
  • For a custom App uploaded to Microsoft Teams, if an organization wants to disallow users from updating the settings of the custo
    12·1 answer
  • The most likely reason a firm would decide to establish an extranet would be the desire to Multiple Choice speed the flow of inf
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!