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]
3 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]3 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
____ is a consistent relational database state in which every foreign key value also exists as a primary key value.​ a. ​ Refere
maria [59]

Answer:

The correct answer is Option A (Referential integrity)

Explanation:

When a relational database table is in ​first normal form, that means it has no repeating fields or groups of fields, and hence all rows have the same columns, while if a relational database table is in second normal form, it implies that every non-key field is functionally dependent on the primary key. If can be in the third normal form if no non-key field is functionally dependent on any other non-key field.​

A relational database on its own is a universal approved database model whose data is stored in tables divided into records and fields that serve as an information unit that organizes data points for easy access.

In the relational database, foreign keys are being checked to reference the primary key and enforce referential integrity so as to ensure that the foreign key must have a matching primary key. It means the reference from a row in one table to another table must be valid. Referential integrity concerns the concept of a foreign key normally enforced by the database management system.

4 0
3 years ago
To make an exact copy of an existing slide, from the new slide gallery
Anuta_ua [19.1K]
If you're talking about Microsoft PowerPoint, just go to the slide view, right click and click "Duplicate Slide".

I'm sure you can also Copy and Paste slides. 
3 0
3 years ago
The part of the poppet valve that contacts the valve seat is called the A. face. B. margin. C. head. D. stem.
Phantasy [73]
It should be A face, I think
6 0
3 years ago
Read 2 more answers
What is a high level language?​
vovikov84 [41]

Answer:

a high level language is any programming language that enables development of a program in a much more user friendly programming context and is generally independent of the computers hardware architecture.

8 0
3 years ago
Read 2 more answers
Write a full class definition for a class named Player, and containing the following members:
ANEK [815]

// making class

class Player {

// Data members

string name;

int score;

// Name setter

void setName(string str){

this.name = str;

}

// Score setter

void setScore(int num){

this.score = num;

}

// Score getter

int getScore(){

return score;

}

// Name getter

string getName(){

return name;

}

};

8 0
3 years ago
Other questions:
  • The salesperson in a cell phone store is telling me that the phone I'm considering has 8GB of memory, which means I can save 10,
    13·1 answer
  • Gary lives in an area that receives a lot of rain throughout the year. which device would be useful to him to maintain his compu
    8·1 answer
  • Which is a requirement for searching for a template
    14·1 answer
  • What are the first letters of each of the 3 main colors in javaScript? (seperate with commas)
    9·1 answer
  • You do not need to remove the lead weights inside tires before recycling them. A) TrueB) False
    15·1 answer
  • What is the command for basic router configuration?
    6·1 answer
  • Sketch a 3-view orthographic projection of the object shown
    6·1 answer
  • Suppose a class Car and its subclass Honda both have a method called speed as part of the class definition. rentalH refers to an
    5·1 answer
  • Sidney needs to create a decimal number variable that will be added to another number. What kind of variable is required?binaryB
    15·1 answer
  • What (if any) are the same feature requirements that might be found in server software/OS environments
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!