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
For multicore processors to be used effectively, computers must understand how to divide tasks into parts that can be distribute
AnnyKZ [126]

Answer: parallel processing

Explanation:

Parallel processing is the process by which the processor has the capacity to execute parallel instruction at the same time. This is possible only by assigning the different task to the different cores present in the cpu. So a cpu with multiple cores are able to process multiple task as the same time parallel.

8 0
2 years ago
3. Choosing a pre-formatted presentation (that already has a design in the slides) is called choosing a ?
Charra [1.4K]

Answer:

3. Choosing a pre-formatted presentation (that already has a design in the slides) is called choosing a ?

Explanation:

3. Choosing a pre-formatted presentation (that already has a design in the slides) is called choosing a ?

7 0
2 years ago
python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. T
iogann1982 [59]

Answer:

<em>The programming language is not stated;</em>

<em>However, I'll answer this question using C++ programming language</em>

<em>The program uses few comments; See explanation section for more detail</em>

<em>Also, the program assumes that all input will always be an integer</em>

#include<iostream>

#include<sstream>

#include<string>

using namespace std;

int main()

{

string input;

cout<<"Enter the first 9 digits of an ISBN as a string: ";

cin>>input;

//Check length

if(input.length() != 9)

{

 cout<<"Invalid input\nLength must be exact 9";

}

else

{

 int num = 0;

//Calculate sum of products

for(int i=0;i<9;i++)

{

 num += (input[i]-'0') * (i+1);    

}

//Determine checksum

if(num%11==10)

{

 input += "X";

 cout<<"The ISBN-10 number is "<<input;

}

else

{

 ostringstream ss;

 ss<<num%11;

 string dig = ss.str();

 cout<<"The ISBN-10 number is "<<input+dig;

}

}  

 return 0;

}

Explanation:

string input;  -> This line declares user input as string

cout<<"Enter the first 9 digits of an ISBN as a string: ";  -> This line prompts the user for input

cin>>input;  -> The user input is stored here

if(input.length() != 9)  { cout<<"Invalid input\nLength must be exact 9";  }  -> Here, the length of input string is checked; If it's not equal to then, a message will be displayed to the screen

If otherwise, the following code segment is executed

else  {

int num = 0; -> The sum of products  of individual digit is initialized to 0

The sum of products  of individual digit is calculated as follows

for(int i=0;i<9;i++)

{

num += (input[i]-'0') * (i+1);

}

The next lines of code checks if the remainder of the above calculations divided by 11 is 10;

If Yes, X is added as a suffix to the user input

Otherwise, the remainder number is added as a suffix to the user input

if(num%11==10)  {  input += "X";  cout<<"The ISBN-10 number is "<<input; }

else

{

ostringstream ss;

ss<<num%11;

string dig = ss.str();

cout<<"The ISBN-10 number is "<<input+dig;

}

}  

5 0
2 years ago
Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; th
Anna71 [15]

Answer:

a)   Consider sequence numbers,First segment=90

Second segment=110

Data in the first segment = 110-90  =20

b) Consider the first segment is lost but the second segment arrives at B. In the acknowledgment that Host B sends to Host A, then the acknowledgment number will be first segment of sequence number, that is 90.

Explanation:

8 0
2 years ago
Read 2 more answers
How can we make our programs behave differently each time they are run?
tensa zangetsu [6.8K]

Answer:

By given the right speech as much as the answers must be

Explanation:

By given the right speech as much as the answers must be

7 0
1 year ago
Other questions:
  • A two-dimensional array can have elements of ________ data type(s).
    7·1 answer
  • 14. If B3=10 and D5=8, what would the following function return? IF(B3&gt;D5, "Closed", D5-B3) *
    9·1 answer
  • Which is true of case-based reasoning (CBR)?
    6·1 answer
  • Suppose a retailer who has no technology expertise wishes to set up an online presence for his business. He ________. a. ​can us
    6·1 answer
  • Which of the following facts determines how often a nonroot bridge or switch sends an 802.1D STP Hello BPDU message?
    14·1 answer
  • Carmina wants to move a paragraph to the right margin of the document she is working in. She moves her cursor to
    8·2 answers
  • While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes
    7·1 answer
  • Which statement about dialogues is NOT correct? Select one: A. Users should be able to control the direction of speed of dialogu
    5·1 answer
  • 6.4 Predicting Prices of Used Cars. The file ToyotaCorolla.csv contains data on used cars (Toyota Corolla) on sale during late s
    5·1 answer
  • Suppose that a class named ClassA contains a private nonstatic integer named b, a public nonstatic integer named c, and a public
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!