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
hjlf
3 years ago
10

You have been hired by Beta Airlines to help them with their flight prices. You are to create a 10 x 10 2D array (also called a

matrix) that holds the prices of their domestic flights between Atlanta and Hawaii. Your program should fill the matrix with random values between $99 and $1999 and allow a user to enter a price that matches their preferred cost for the flight. You should then process the 2D array and return whether or not a price in the array matches their requested price (exactly matches).
Computers and Technology
1 answer:
AveGali [126]3 years ago
4 0

Answer:

See explaination

Explanation:

//Array to store prices

INT PRICE[10][10]

//Loop through 2d array

FOR I FROM 0 TO 10

FOR J FROM 0 TO 10

//Populate a random int

PRICE[I][J] = RANDOM_INT(99,1999)

PRINT(PRICE[I][J]+" ")

PRINT()

//Prompt user for desired price

COST = READ_INPUT('Please enter your desired flight price: ')

//Variable to store if a match is found

MATCH = FALSE

//Loop through all ints in price

FOR I FROM 0 TO 10

FOR J FROM 0 TO 10

//Compare price with Cost

IF PRICE[I][J]==COST

MATCH = TRUE

BREAK

//Check if match is true

IF MATCH = TRUE

PRINT('A flight was found for that price, have a safe trip!')

ELSE

PRINT('No flight was found for that price, please try a new price.')

You might be interested in
You want to find information about Paris, France in the last five years, written in English. What is the best way to search for
KonstantinChe [14]
I say It could be B
8 0
3 years ago
Read 2 more answers
What is cpu?<br>please give me right answer ​
LUCKY_DIMON [66]

Answer:

Explanation:

processor such as intel/amd processors

7 0
2 years ago
Read 2 more answers
Why was 1990 an important year regarding air quality?
fredd [130]

Explanation:

The United States created the Environmental Protection Agency. in some ways they have did that

4 0
3 years ago
Read 2 more answers
C++
Cerrena [4.2K]

Answer:

#include <iostream>

#include<iomanip>

using namespace std;

double DrivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon)

{

  double dollarCost = 0;

  dollarCost = (dollarsPerGallon * drivenMiles) / milesPerGallon;

  return dollarCost;

}

int main()

{

  double miles = 0;

  double dollars = 0;

  cout << "Enter miles per Gallon   : ";

  cin >> miles;

  cout << "Enter dollars per Gallon: ";

  cin >> dollars;

  cout << fixed << setprecision(2);

  cout << endl;

  cout << "Gas cost for 10 miles : " << DrivingCost(10, miles, dollars) << endl;

  cout << "Gas cost for 50 miles : " <<DrivingCost(50, miles, dollars) << endl;

  cout << "Gas cost for 400 miles: "<<DrivingCost(400, miles, dollars) << endl;

  return 0;

}

Explanation:

  • Create a method definition of DrivingCost that accepts  three input double data type parameters drivenMiles,  milesPerGallon, and dollarsPerGallon and returns  the dollar cost to drive those miles .
  • Calculate total dollar cost and store in the variable, dollarCost .
  • Prompt and read the miles and dollars per gallon  as input from the user .
  • Call the DrivingCost function three times  for the output to the gas cost for 10 miles,  50 miles, and 400 miles.

 

4 0
3 years ago
Read 2 more answers
A film company want to video animals in the wild acting naturally. They decide to
erik [133]

Answer:

y

Explanation:

g

5 0
2 years ago
Other questions:
  • Paulene is using this table in Word,and she started with the cursor in the box that read “Flavor”. she then hits Alt+End,The the
    7·1 answer
  • What sugar is used in a DNA molecule​
    7·2 answers
  • from january 2005 through july 2015, approximately how many electronic data records in the United States were breached, exposing
    13·1 answer
  • Why is it important to have user accounts? describe the purpose, features and functions of user accounts (including administrato
    5·1 answer
  • A restaurant has a case type that allows customer to book the dining room for events. Customers provide basic information includ
    7·1 answer
  • 1- How should an operating system support communication between applications? explain your reasoning?
    10·1 answer
  • Today when Dylan turned on his computer, he noticed that the monitor was very dim. He could still see the desktop icon and text.
    15·1 answer
  • Which statement reflects an opinion about technology? Select all that apply. Select one or more: a. It is easy to imagine that a
    5·1 answer
  • State three advantages of using a printer​
    15·1 answer
  • If you delete a conversation many times with someone like this, will you stop receiving messages from them?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!