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
Sahil is making a graphic novel in which the villain plans to reduce the rate at which energy is released from the Sun. The vill
gregori [183]

i believe the answer is b

hope this helps :)

8 0
3 years ago
Read 2 more answers
To execute a prepared SQL statement, you can use the ________________ and execute() methods of the PDOStatement object to set pa
svet-max [94.6K]

Answer:

The correct answer to the following question will be "bindValue".

Explanation:

  • The PDO declaration bind-value feature allows to bind a value or a function to a argument or a parameter.
  • To run a compensated statement of SQL, you could also use the PDOStatement object's bindvalue and execute() methods to set values of the paramenter or any argument and implement the comment.

Therefore, it's a right answer.

8 0
3 years ago
DJ Davon is making a playlist for an internet radio show; he is trying to decide what 1212 songs to play and in what order they
Alja [10]

There are some typos in this question as the numbers become too large and lead to undefined during calculations.

so the correct data is:

Songs = 12

Rock = 15

Blues = 20

Disco = 15

The answer & explanation for this question is given in the attachment below.

4 0
3 years ago
PLEASE HELP <br> Which of the following best describes the existence of undecidable problems?
Tju [1.3M]

Answer:

D.

Explanation:

Its the exact definition of an undecidable problem. Plus I have my notebook open next to me and that's what it says, trust bro.

7 0
3 years ago
If im downloading a game at 4mb/s how many minutes would it take to download 25 GB
xxMikexx [17]

Answer:

File size  

25  GB  

Connection type Download speed Download time

Modem    28,8 kbit/s                   2071:15:40

Modem     56,6 kbit/s                         1065:13:12

ADSL       256 kbit/s                         233:01:00

ADSL       512 kbit/s                         116:30:30

ADSL       1 Mbit/s                                     59:39:08

ADSL             2 Mbit/s                                     29:49:34

ADSL             8 Mbit/s                                     07:27:23

ADSL             24 Mbit/s                                     02:29:07

LAN             10 Mbit/s                                                 05:57:54

LAN             100 Mbit/s                                     00:35:47

Turbo 3G 7,2 Mbit                           08:17:06

4G             80 Mbit/s                                     00:44:44

Hopefully this helps somewhat

7 0
2 years ago
Read 2 more answers
Other questions:
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    15·1 answer
  • Websites that group individuals and organizations into clusters or groups based on some sort are considered to be what type of n
    11·1 answer
  • The material of this section assumes that search keys are unique. However, only small modifications are needed to allow the tech
    7·1 answer
  • Explain how arrays are stored in memory? Show how arr [5] is stored in the memory. Assume each memory location is one byte long
    6·1 answer
  • Relation between training and occupation with examples in points . Plz tell fast<br> ​
    5·1 answer
  • Select each of the strategies you can use to be more efficient when using the Internet. using tabs creating tables creating book
    6·2 answers
  • HELP ASAP !!! What should be a one-page document?
    7·1 answer
  • quiz Flavio visits a local coffee shop on his way to school and accesses its free Wi-Fi. When he first connects, a screen appear
    7·1 answer
  • Compare and contrats the vain digestive system from the human digestive system.​
    10·1 answer
  • Write a paragraph explaining why you think its important to use ethics in computers
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!