1answer.
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
meriva
3 years ago
8

Write a program that declares a constant named QUARTS_IN_GALLON which holds the number of quarts in a gallon (4). Also declare a

variable named quartsNeeded to represent the number of quarts needed for a painting job, and assign an appropriate value. Compute and display the number of gallons and quarts needed for the job. Display explanatory text with the values—for example, A job that needs 18 quarts requires 4 gallons plus 2 quarts.
Computers and Technology
1 answer:
Hunter-Best [27]3 years ago
5 0

Answer:

The c++ program for the given scenario is shown below.

#include <iostream>

using namespace std;

int main() {

   // value is mentioned in the question

   const int QUARTS_IN_GALLON = 4;

   // any positive integer value can be assigned

   int quartsNeeded = 25;

   int gallons, quarts;

   // 0 will be assigned if quartsNeeded is less than QUARTS_IN_GALLON

   gallons = quartsNeeded/QUARTS_IN_GALLON;

   // 0 will be assigned if quartsNeeded is completely divisible by QUARTS_IN_GALLON

   quarts = quartsNeeded%QUARTS_IN_GALLON;

   cout << "A job that needs " << quartsNeeded << " quarts requires " << gallons << " gallons plus " << quarts << " quarts." << endl;

   return 0;

}

OUTPUT

A job that needs 25 quarts requires 6 gallons plus 1 quarts.

Explanation:

This program is not designed to take any input from the user and hence, no validation is implemented.

1. A constant integer variable is declared to hold the number of quarts present in a gallon of paint.

const int QUARTS_IN_GALLON = 4;

2. An integer variable is declared to hold the quarts of paint needed for the job. This variable is initialized inside the program.

int quartsNeeded = 25;

3. Two integer variables are declared to hold the number of gallons and quarts calculated from the variables declared and initialized previously.

4. The number of gallons is computed as shown. Since gallon variable is an integer variable, it will store only the integer part of the result.

gallons = quartsNeeded/QUARTS_IN_GALLON;

If there is no remainder for the above expression, the variable quarts will be assigned 0. Hence, no validation is required for this.

5. The number of quarts is computed as shown. Since quarts variable is an integer variable, it will store only the integer part of the result.

quarts = quartsNeeded%QUARTS_IN_GALLON;

If there is no remainder for the above expression, the variable quarts will be assigned 0. Hence, no validation is required for this.

6. Lastly, display the message informing the number of gallons and quarts needed in all.

7. The program ends with a return statement.

You might be interested in
What is the most common form of renewable energy used to generate electricity
sertanlavr [38]

i think that it’s either sunlight or solar energy

6 0
3 years ago
What does technological convergence mean, with examples?
Brrunno [24]

Answer:

Technological convergence is a term describes the layers of abstraction that enable different technologies t inter operate efficiently as a converged system. Convergent services such as VoIP, IPTV, Smart TV and others tend to replace the older technologies.

Explanation:

As a feature of society convergence can spur economic growth and change how people communicate on a global basis. A good way t evaluate the previous generations, items such as CD player, cassette deck, console TV or corded telephone each served only one function, whereas a single modern handheld computing device can meld several of those functions with hardly any user intervention required.

7 0
3 years ago
Before the 20th century how did most people experience computing​
frozen [14]

Answer:

   

Explanation:

3 0
3 years ago
In your Ice Breakers game, when does the player lose a life?
Ivanshal [37]

Answer:

D. When the snowball leaves the play area on the bottom

5 0
3 years ago
Read 2 more answers
Explain two protocols to enhance cellular networks capacity?
Korvikt [17]

The mobile network capacity can be improved by increasing the radio spectra or also increasing the re-utilization of a given spectrum.

<h3>What is mobile network capacity?</h3>

The mobile network capacity refers to the final volume of information (data) that can be transferred to a particular customer.

A mobile wireless system refers to a given network where the connection to and from customers consists of wireless technology.

The mobile network capacity is usually improved in a given area by increasing the radio spectra or increasing the re-utilization of the spectrum.

Learn more about mobile wireless systems here:

brainly.com/question/1763761

4 0
2 years ago
Other questions:
  • The brainly home page uses about 112% of my cpu. (On chromebook) any ideas to help increase performance?
    7·2 answers
  • Which type of password would be considered secure?
    15·1 answer
  • 1. Which of the following is NOT an example of systems software? (Points : 1)
    5·2 answers
  • Timothy was reading tournament results of the football World Cup matches on Infogoalistic.com. As he was going through the resul
    14·1 answer
  • What is the easiest way to tame a dire wolf on Ark Survival Evolved?
    14·1 answer
  • Write any two merits and demerits of computer​
    8·1 answer
  • Explain why agile methods may not work well in organizations that have teams with a wide range of skills and abilities and well-
    7·1 answer
  • The average numbers of shares a piece of content receives is known as its:
    7·1 answer
  • Please help!!! Question 8
    14·1 answer
  • The ____________ command / function is used in Python graphics and text-based programming code.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!