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
vredina [299]
3 years ago
11

Create a program to determine the largest and smallest number out of 15 numbers entered (numbers entered one at a time). This sh

ould be done in a function using this prototype: double larger (double x, double y); Make sure you use a for loop expression inside your function. Enter 15 numbers 11 67 99 2 2 6 8 9 25 67 7 55 27 1 1 The largest number is 99
Computers and Technology
1 answer:
Shkiper50 [21]3 years ago
7 0

Answer:

#include <iostream>

using namespace std;

double larger( double x, double y){

   if (x > y){

       return x;

   } else{

       return y;

   }

}

int main(){

   int n, max = 0;

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

       cout<< "Enter item"<< i+1 << ": ";

       cin>> n;

       cout<< "\n";

       max = larger( n, max);

   }

   cout<<"The maximum number is: "<< max;

   return 0;

}

Explanation:

The C++ program defines the function 'larger' that compares and returns the largest of two numbers. The main program prompts the user for 15 numbers and the larger function is called to return the largest of the fifteen numbers given.

You might be interested in
_______ refers to the poitically, religiously, or ideologically motivated use of computers (or related technology) by an individ
Anettt [7]

Answer:

The answer of the following blank is Cyberterrorism .

Explanation:

Cyberterrorism is the violent act by the use of an internet that results in the threat of any important files or the loss of life or the significance of the bodily harms, to achieve an ideological or political gains through the threat or the intimidation.

6 0
3 years ago
A web crawler uses a search _______ to traverse the web.​
aliina [53]
<span>A web crawler uses a search algorithm to traverse the web.
</span>The web crawler is responsible for the process of browsing the net. It systematically browses the World Wide Web<span> by looking at the keywords in the pages, the kind of content each page has and the links, and then return this information to the search engine.</span>
The process is called Web crawling or spidering.
7 0
3 years ago
The Gas-N-Clean Service Station sells gasoline and has a car wash. Fees for the car wash are $1.25 with a gasoline purchase of $
Xelga [282]

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

              //print the header

              System.out.println("**************************************");

              System.out.println("*                                    *");

              System.out.println("*                                    *");

              System.out.println("*   Gas-N-Clean Service Station      *");

              System.out.println("*                                    *");

              System.out.println("*   March 2, 2004                    *");

              System.out.println("*                                    *");

              System.out.println("**************************************");

 

               //set the constant values for gasoline

               final double REGULAR_GASOLINE = 2.89;

               final double PLUS_GASOLINE = 3.09;

               final double SUPER_GASOLINE = 3.39;

 

              // initialize the variables as 0

              double gasolinePrice = 0, gasolineCost = 0, carWashCost = 0, totalCost = 0;

 

               Scanner input = new Scanner(System.in);

 

               //ask the user to enter the gallons, gas type and car wash choice

               System.out.print("Enter number of gallons ");

               double gasolinePurchase = input.nextDouble();

               System.out.print("Enter gas type (R, P, S, or N) ");

               char gasType = input.next().charAt(0);

               System.out.print("Enter Y or N for car wash ");

               char carWashChoice = input.next().charAt(0);

               //check the gas type. Depending on the choice set the gasolinePrice from the corresponding constant value

              if(gasType == 'R')

                  gasolinePrice = REGULAR_GASOLINE;

              else if(gasType == 'P')

                  gasolinePrice = PLUS_GASOLINE;

              else if(gasType == 'S')

                  gasolinePrice = SUPER_GASOLINE;

 

                //calculate the gasolineCost

                gasolineCost = gasolinePurchase * gasolinePrice;

 

               //check the carWashChoice. If it is yes and gasolineCost is greater than 10, set the carWashCost as 1.25. Otherwise, set the carWashCost as 3.00

               if(carWashChoice == 'Y'){    

                   if(gasolineCost >= 10)

                       carWashCost = 1.25;

                   else

                       carWashCost = 3.00;

               }

              //calculate the total cost, add gasolineCost and carWashCost

              totalCost = gasolineCost + carWashCost;

 

               //print the values in required format

              System.out.println("Amount Gasoline purchases " + gasolinePurchase);

              System.out.println("Gallons Price per gallons $ " + gasolinePrice);

              System.out.printf("Total gasoline cost $ %.2f\n", gasolineCost);

              System.out.println("Car wash cost $ " + carWashCost);

              System.out.printf("Total due $ %.2f\n", totalCost);

               System.out.println("Thank you for stopping\nPlease come again \nRemember to buckle up and drive safely");

}  

}

Explanation:

*The code is in Java.

Please see the comments in the code for explanation

4 0
3 years ago
software that instructs the computer how to run applications and controls the display/keyboard is known as the what?
Tomtit [17]
<span>The software that instructs the computer how to run applications and controls the display /keyboard is known as DRIVERS software, A driver is a software program that enables a specific hardware device to work with a computers operating system. Drivers may be required for internal components such as video cards and optical media drives.</span>
7 0
3 years ago
_______ and _____ are two major techniques involved in green computing. NextReset
FrozenT [24]
Green computing is the use of computers and related resources which is environmentally responsible. Energy-efficiency and e-waste are two major techniques involved in green computing. Energy efficiency involves implementation of energy-efficient central processing units (CPUs), servers and peripherals as well as reduced resource consumption. And e-waste is the proper disposal of electronic waste.


3 0
3 years ago
Read 2 more answers
Other questions:
  • Which method of deleting files can be used in windows xp and vista?
    12·1 answer
  • A cyberbully is someone who invades another person’s privacy by
    13·2 answers
  • Suppose we are comparing implementations of insertion sort and merge sort on the same machine. for inputs of size n, insertion s
    10·1 answer
  • What is the formula that calculates the session fee for members in excel
    13·1 answer
  • In CadStd, what does the Zoom All button do? A. Makes a drawing bigger so you can see small details B. Returns a drawing to a si
    5·1 answer
  • If you need to grasp the topic of a document quickly, which strategy can you follow? A. guessing from context B. paraphrasing C.
    7·2 answers
  • Which file extension takes less storage space?
    13·2 answers
  • Match the protocols to their use. HTTP POP3 SMTP FTP You check email in your inbox. arrowRight You send an email to a friend. ar
    14·1 answer
  • Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as t
    14·1 answer
  • What are the nuclear codes?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!