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
What is the age group for the silent genration
Maurinko [17]
21 years old. If you take 1944-1923 you get 21 because that would be ho wold they are
7 0
3 years ago
A browser is an example of a. :
UNO [17]
A browser is an example of a system application
5 0
2 years ago
In this chapter, you saw an example of how to write an algorithm that determines whether a number is even or odd. Write a progra
vagabundo [1.1K]

Answer:

// Program is written in Java Programming Language

// Comments are used for explanatory purpose

// Program starts here

public class RandomOddEve {

/** Main Method */

public static void main(String[] args) {

int[] nums = new int[100]; // Declare an array of 100 integers

// Store the counts of 100 random numbers

for (int i = 1; i <= 100; i++) {

nums[(int)(Math.random() * 10)]++;

}

int odd = 0, even = 0; // declare even and odd variables to 0, respectively

// Both variables will serve a counters

// Check for odd and even numbers

for(int I = 0; I<100; I++)

{

if (nums[I]%2 == 0) {// Even number.

even++;

}

else // Odd number.

{

odd++;

}

}

//.Print Results

System.out.print("Odd number = "+odd);

System.out.print("Even number = "+even);

}

8 0
3 years ago
Read 2 more answers
What type of traffic always goes to all devices in a subnet?
zmey [24]
There are three types of traffic in an IP network:
1. Unicast -  one-to-one traffic (traffic from one sender to one receiver) 
2. Multicast - one to many traffic (one sender and more receivers) 
3.Broadcast -  every device in the network will receive the packet
So, the broadcast traffic <span>always goes to all devices in a subnet. </span>
6 0
3 years ago
Your boss is trying to modify a PDF file that he made a year ago. He asks you what he can use to do this. Which of the selection
Masteriza [31]
The answer is b. Office 2013
3 0
3 years ago
Read 2 more answers
Other questions:
  • DJ wants to see how his document will look when printed. Where would he find the button to see the document in print view? the P
    5·2 answers
  • Identify the six components of an information system. Which are most directly affected by the study of computer security? Which
    8·1 answer
  • Using the _____ model brings sellers and buyers together on the web and collects commissions on transactions between these parti
    5·1 answer
  • Which technology forms the foundation for cloud computing? forms the foundation for cloud computing.
    12·2 answers
  • Which of the following types of network can only be accessed by members within a private organization?
    5·1 answer
  • Before the electronic era information was usually directly communicated and not recorded, much of the information you received w
    9·1 answer
  • Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less
    6·2 answers
  • The term "exception propagation" means:
    5·1 answer
  • What is the output of the following program?
    5·1 answer
  • What is the output for the following code?<br><br> print (5*4+5)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!