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
Nadya [2.5K]
2 years ago
5

Write a method that finds the cheapest name of apples, and returns back a String stating what the apple name is and how much it

costs. The method should take two arrays as two parameters (you do not need to make a two dimensional array out of these arrays).
Computers and Technology
1 answer:
Korolek [52]2 years ago
7 0

The question is incomplete! Complete question along with answer and step by step explanation is provided below.

Question:

Two arrays are given:  

String apples[] = {"HoneyCrisp", "DeliciousRed", "Gala", "McIntosh",  "GrannySmith"};

double prices[] = {4.50, 3.10, 2.45, 1.50, 1.20};

Write a method that finds the cheapest name of apples, and returns back a String stating what the apple name is and how much it costs. The method should take two arrays as two parameters (you do not need to make a two dimensional array out of these arrays).

Answer:

The complete java code along with the output is prrovided below.

Java Code:

public class ApplesCheap

{

   public static String Cheapest(String apples[], double prices[])

 {

       int temp = 0;

       for (int i = 0; i < apples.length; i++)

    {

         if (prices[i] < prices[temp])

          {

               temp = i;

           }

       }

       return apples[temp];

   }

public static void main(String[] args)

{

// define the array of apple names and their prices

  String apples[] = {"HoneyCrisp", "DeliciousRed", "Gala", "McIntosh", "GrannySmith"};

  double prices[] = {4.50, 3.10, 2.45, 1.50, 1.20};

// print the cheapest apple by calling the function Cheapest

  System.out.println("The cheapest apple is: " + Cheapest(apples, prices));

   }

}

Output:

The cheapest apple is: GrannySmith

You might be interested in
In poor weather , you should ___ your following distance.
svlad2 [7]

Answer:

lengthen

Explanation:

will take more time to stop on wet and slippery surfaces

3 0
3 years ago
9 dmz, vpn, vlan where in the network do you place a dmx, why, what attacks are prevented? what does a vpn do, provide an exampl
creativ13 [48]

At the: Firewall, the DMZ is configured in the Organization. Within the firewalls, it is accessible. They have been completed with the intention of adding an additional layer of safety to the organization to protect it.

The DMZ safeguards not only the web server but also the remainder of the network. To allow visitors to the network to access the web server, a security breach must be made.

The DMZ lessens the possible risk caused by this gap. A secure network, protected by the FortiGate, that only permits access if it has been specifically authorized is known as a DMZ network (from the term "demilitarized zone").

In this illustration, a private subnet is used by the DMZ network, which permits access to a web server by internal and external users using distinct addresses while blocking access from the web server to the internal network in the case that the web server is compromised.

To know more about DMZ click on the link:

brainly.com/question/2920815

#SPJ4

7 0
1 year ago
I don't understand how to write code for this in Java using nested for loops only. The official question is: write a program tha
Bingel [31]

Answer:

public class Triangle

{

public static void main( String[] args )

{

show( 5 );

}

public static void show( int n )

{

int i,j,k;

for (i = 0; i < n - 1; i++ )

{

for (j = 0; j < i; j++ )

{

System.out.print( " " );

}

for (k = n - i; k > 0; k-- )

{

System.out.print( "* " );

}

System.out.println();

}

for (i = 0; i < n; i++ )

{

for (j = n - i; j > 1; j-- )

{

System.out.print( " " );

}

for (k = 0; k < i + 1; k++ )

{

System.out.print( "* " );

}

System.out.println();

}

4 0
2 years ago
The primary reason for the creation of the Federal Reserve System LOADING... ​was: A. to create a single central bank similar to
Gelneren [198K]

Answer: (C) to reduce or eliminate future bank panics.

Explanation:

The Federal Reserve System being the central reserve system in the US was created with the primary objective of reducing and eliminating bank panics in periods of recessions and depressions and other bank related matters.

3 0
3 years ago
The following program draws squares recursively. Fill in the missing code. import javax.swing\.\*; import java.awt\.\*; public c
ExtremeBDS [4]

Answer:

The missing code to this question is g.

Explanation:

In this question firstly import packages. Then declaration of the class Test that inherits the JApplet. In this class, we declare the default constructor. In this constructor, we call the add function. Then we declare another class that is SquarePanel. This class inherits JPanel. In this class, we define a method that is paintComponent(). In this method, we define an integer variable. In this method, we perform calculations and pass it to another function that is displaySquares(). In this function, we pass the value as the arguments. So in question the missing code or argument is g.

8 0
3 years ago
Other questions:
  • Ted wants to follow the StartSafe philosophy when working around electricity. Which of the following steps would be consistent w
    15·2 answers
  • Software that gives network administrators the ability to provide computer assistance from a central location by allowing them t
    15·1 answer
  • Why are application programs stored in main memory​
    11·1 answer
  • What is the best operating system
    12·1 answer
  • Similarities between inline css and internal css​
    6·1 answer
  • Categorize each of the following situations as a compile-time error, run-time error, or logical error. Group of answer choices m
    5·1 answer
  • The address for the website you want to visit is called the browser internet URL World Wide Web
    5·2 answers
  • Which are print settings that can be modified in word 2019 choose two answers​
    8·1 answer
  • What can handle work that is hard on a person and could cause repetitive injuries?
    6·1 answer
  • question 1 scenario 1, question 1-5 you’ve just started a new job as a data analyst. you’re working for a midsized pharmacy chai
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!