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
Cutting of trees is bad or not bad​
olga_2 [115]
It is bad cutting tree :(
7 0
3 years ago
Read 2 more answers
Each frame is composed of a number of colors recorded in digital format; we call these pixels. What information does the number
Nookie1986 [14]
I'd say the size of the frame.

The size, quantity and color combination of pixels is measured in terms of display resolution. A resolution, however, is the number of pixels in an image and is identified by the width and the height. How you’ve set the resolution for the display screen will determine the specific size of the pixels.






7 0
4 years ago
Combustion is an example of to energy conversion.
Marizza181 [45]
If this is a true or false question I would say true... but I dont know I’m confusion <3
7 0
3 years ago
Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consis
Helga [31]

Answer:

Explanation:

The language I use would do it as

h1$ = copy(h$,1,3)

This may not satisfy you, because your language could be quite different. You might want an input statement of some kind that would define h$. This assumes that somewhere h,h1 are declared as  strings.

You also have to know how to read an input. My language uses readln(input,h)

and how to write it on the screen write(h1) or writeln(h1)

6 0
3 years ago
What is the specifications, number of sales, positive and negative points and a few popular games of the first PlayStation?
Semmy [17]
Specs:
CPU
R3000A 32bit RISC chip @ 33.8mhz - Manufactured by LSI Logic Corp.
Clearing capacity: 30 MIPS
Bus bandwidth: 132 Mb/sec

3D Geometry Engine
High speed matrix calculator
Clearing capacity: 66 MIPS
1.5 million flat-shaded polygons/sec
500,000 texture-mapped and light-sourced polygons/sec

Data Engine (MDEC)
Clearing capacity: 80 MIPS
CPU, direct bus connection
Also compatible with JPEG, H.261 files

Sound
ADPCM, 24 channels
Sampling frequency: 44.1 Khz

Graphics
16.7 million colors
Resolution: 256x224 - 740x480
Sprite/BG drawing
Adjustable frame buffer
No line restriction
Unlimited CLUTs (Color Look-Up Tables)
4,000 8x8 pixel sprites with individual scaling and rotation
Simultaneous backgrounds (Parallax scrolling)
360,000 polygons/sec

Memory:
Main RAM: 2 Megabytes
VRAM: 1 Megabyte
Sound RAM: 512 K
CD-ROM buffer: 32K
Operating System ROM: 512K
RAM cards for data save: 128K EEprom

Cd-rom
Double speed
<span>XA compliant
</span>
Number of sales: 102.49 million

Pros: Great game selection. Fantastic 3D graphics for the time, elegant console design, memory cards convenient and meant never running out of space and could play saved games on another console. Comfortable controllers, games stored in standard CD cases.

Cons: Long load times. <span>Often overheated which would cause audio skipping, even longer load times, and sometimes system failure! </span><span>Memory cards don't hold much.</span>

Games: Ridge Racer, Battle Arena Toshinden, and ESPN Extreme Games. on release. Later Spyro the Dragon, Tekken, Wipeout, Crash Bandicoot, Tomb Raider, Metal Gear Solid, Gran Turismo, Resident Evil, Silent Hill, Soul Blade, and Twisted Metal.
5 0
3 years ago
Other questions:
  • Which version represents the video project after the assembly cut has been completed, transitions and special effects have been
    9·1 answer
  • How many inputs are included in the following requirement? REQUIREMENT: Write a program that asks the employee for their age. Th
    6·1 answer
  • Radio waves pros and cons
    10·2 answers
  • Which domain ending can only be used by educational institutions?
    12·1 answer
  • This morning when Paul turned on his computer at work, it would not boot. Instead, Paul reported that he heard a loud clicking n
    12·1 answer
  • For anyone who plays warzone, do you think the hdr has earned its spot back after the spr nerf? Be completely honest plz.​
    8·1 answer
  • Many company websites are now designed to do more than just sell a product. These​ websites, known as​ __________ websites, atte
    14·1 answer
  • Kristi, an event planner, wants to store caterers’ names and contact information in an organized manner. Kristi will MOST LIKELY
    13·1 answer
  • What percentage of teens say they have witnessed cyberbullying?
    6·2 answers
  • Irma bought a gaming computer at Bestbuy 3 years ago and it’s been on ever since. Her computer is staring to feel unstable and a
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!