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
BigorU [14]
2 years ago
10

Write a program that declares three one-dimensional arraysnamed miles, gallons, and mpg. Each array should be declared in main()

and should becapable of holding ten double-precision numbers. The numbers that should be stored in miles are240.5, 300, 189.6, 310.6, 280.7, 206.9, 199.4, 160.3, 177.4, and 192.3. The numbers should bestored in gallons are 10.3, 15.6, 8.7, 14, 16.3, 15.7, 14.9, 10.7, 8.3, and 8.4.
Computers and Technology
1 answer:
Helen [10]2 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main(){

   double miles[10] = {240.5, 300, 189.6, 310.6, 280.7, 206.9, 199.4, 160.3, 177.4, 192.3};

   double gallons[10] = {10.3, 15.6, 8.7, 14, 16.3, 15.7, 14.9, 10.7, 8.3, 8.4};

   double mpg[10];

   for (int i = 0; i < 10; i++){

       mpg[i] = miles[i]/ gallons[i];

       cout << "mpg: " << mpg[i] << endl;

   }

}

Explanation:

The C++ source code declares three arrays miles, gallons and mpg with an array length of 10. The gallons and miles arrays are assigned 10 array items each and they are used to push values to the mpg array in the for loop statement. The result of each item in the mpg array is displayed on the screen.

You might be interested in
13. By adding built-in writable memory to its cartridge, Nintendo’s _________________ was the first console game that gamers cou
Rzqust [24]

The answer is c
Explanation:
5 0
3 years ago
Write a filter that reads in a sequence of integers and prints the integers, removing repeated values that appear consecutively.
lara31 [8.8K]

Answer:

Following is the code for filter:

public class filter

{ public static void main(String[] args)

{ int x = StdIn.readInt();

System.out.print(" " + x + " ");

while(!StdIn.isEmpty())

{ int y = StdIn.readInt();

    if(y != x)

          System.out.print(" " + y + " ");

    x = y;

    }

    }

    }

Explanation:

  • A public class filter is used.
  • The main function will accept a single argument as string[], it is also known as java command line argument.
  • Now the Stdln.readInt is used to read the integers in the sequence and store it in integer x.
  • The value stored in variable x will be printed using System.out.print
  • Now unless the Stdln.readInt gets an empty value, check each value of sequence and store in variable y.
  • If y is not equal to previous value x, print it and shift the value of y into x.
  • Repeat the loop again.

i hope it will help you!

7 0
3 years ago
Read 2 more answers
Which of the following color palettes for the BackColor and ForeColor properties contains colors that are guaranteed to be displ
Norma-Jean [14]

Answer: 1)System Palette

Explanation: System palette is kind of palette found in the system which contain the color values that is used by the display.This palette is also  drawing of the devices and applications.But the application don't get the direct access to the system palette rather logical palette permits it.

They work on the basis of the properties carried from the Back color and Fore color.Other palettes mention in the option is incorrect because these palettes don't work for the operating system's display .Thus the correct option is option(1).

8 0
3 years ago
The Euclidean algorithm - The Euclidean algorithm provides a wonderful way to calculate the greatest common factor of 2 numbers.
Murljashka [212]

The pseudo-code of the algorithm will be:

Start

Set n1 equal to 145 and n2 equal to 87.

Divide n1 by n2 and find the remainder.

Set n1 equal to n2 and n2 equal to the remainder.

Repeat steps 2 and 3 until the remainder is equal to 0.

The greatest common factor is n1.

End

What do you mean by pseudocode?

In computer science, pseudocode is indeed a plain language description of a steps in an algorithm or similar system. Pseudocode frequently employs structural patterns of a conventional programming language, although it is designed for human interpretation rather than machine reading. It generally omits features necessary for computation of the algorithm, including such variable declarations and language-specific code. When possible, the programming language is supplemented by natural language description details or succinct mathematical notation.

To learn more about pseudocode

brainly.com/question/24735155

#SPJ9

4 0
1 year ago
When creating a document template, you can either start from an existing document or begin from _____.
Anna35 [415]
A new blank document
7 0
3 years ago
Other questions:
  • Describe any five GSM PLMN basic services?
    10·1 answer
  • The design of a blog refers to:
    10·1 answer
  • discuss the benefits of normalization, and do you think we should normalize our designs to higher levels than 3NF? Why or why no
    9·1 answer
  • The first known permanent photograph was called "View from the Window at Le Gras." True False
    9·1 answer
  • An IT security threat is anything that might cause serious harm to a computer system, including someone stealing a laptop that c
    8·2 answers
  • What are some example of popular music for teenagers
    8·2 answers
  • I only put one answer and didn’t specify what it answered
    14·2 answers
  • What is an analog computer?<br>​
    11·2 answers
  • PLEASE I NEED HELP WITH THIS, IS FOR TODAY
    10·2 answers
  • Discuss the advantages and disadvantages of supporting links to files that cross mount points (that is, the file link refers to
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!