answer.
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
erastova [34]
2 years ago
11

In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func

tion that takes the distance traveled (in kilometers) as its only parameter and returns the total fare as its only result. Write a main program that demonstrates the function.
Computers and Technology
1 answer:
devlian [24]2 years ago
7 0

Answer:

// here is code in java.

import java.util.*;

// class definition

class Main

{

// method that return total fare

   public static double fare(double dis)

   {

   // calculate the total fare

       double tot_fare=(4+((dis*1000)/140)*0.25);

       return the fare

       return tot_fare;

   

   }

   //driver method

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read input string

       Scanner s=new Scanner(System.in);

        // variable

       double dis;

       System.out.print("please enter the distance in KM: ");

       //read the number

       dis=s.nextDouble();

       

       // call the function with "dis" parameter

     double ride_fare=fare(dis);

     // print the total fare

     System.out.println("total fare is: "+ride_fare);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read the distance from user with the help of scanner class.Call the function with parameter "dis".Here it will calculate the total fare as (4+((dis*1000)/140)*0.25). Here base fare is $4 and $0.25 for every 140 meter.Then function will return the total fare.

Output:

please enter the distance in KM: 7                                                                                                                            

total fare is: 16.5  

You might be interested in
Match the careers with the career clusters.
creativ13 [48]
<h2>Answer and Explanation:</h2>

The picture shows the right careers with their respective career clusters.

4 0
2 years ago
Read 2 more answers
Look at the top 3 banking activities done via mobile banking vs. online banking. What characteristics do you notice for both?
muminat

Answer:  <em>The biggest difference between the two is their functionality. Internet Banking allows you to conduct online transactions through your PC or laptop and an internet connection. On the other hand, mobile banking can be done with or without internet. Many banks nowadays have their mobile apps for mobile banking.</em>

Disadvantages of Mobile Banking

<em>If the customer does not have a smartphone than the use of Mobile Banking becomes limited. A transaction like transfer of funds is only available on high-end phones. Regular use of Mobile Banking may lead to extra charges levied by the bank for providing the service.</em>

<em />

Explanation: <u><em>Was this helpful to you? if so please put me Brainlyest.</em></u>

4 0
2 years ago
Write a loop that prints each country's population in country_pop. Sample output for the given program.
Illusion [34]

Answer:

Correct code for the above question which is written after the defined list to display the output.

for x,y in country_pop.items(): #for  loop to prints the list items.

   print(str(x)+" has "+str(y)+" people") #print function to print the value.

Output:

  • The above code is in python language which display the output as the above question demands.

Explanation:

  • The above question code is written in python language to display the result, but this code is not correct.
  • The above code needs a 'for' loop, which will render the list item one by one.
  • The above-list defined in the form of key-value pair, So there is a need for the ''item" function which is the part of the python dictionary to display the list items.
  • There also needs to define the two variables in the for loop, one is for key and the other is for value.
7 0
2 years ago
An ISP is granted the block 16.12.64.0/20. The ISP needs to allocate addresses for 8 organizations, each with 256 addresses. a.
melisa1 [442]

Answer:

I did not understand a thing from your writing

8 0
2 years ago
Chinh wants to have a program print, "Sorry, but that isn’t one of your options" until the user enters the correct information.
kolbaska11 [484]

Answer:

a wile loop

Explanation:

8 0
2 years ago
Other questions:
  • A search box does all of the following EXCEPT ________.
    12·2 answers
  • What infrastructure model provides access to shared computing resources over a network, often the internet?
    13·1 answer
  • When ____ occur during preliminary debugging, dummy print statements—statements that are temporarily inserted into the code to d
    9·1 answer
  • When does the narrator of "EPIC 2015" say the "road to 2015" began?
    10·2 answers
  • rite a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original main
    7·1 answer
  • Sean is forecasting the time and cost of developing a customized software program by looking at the number of inputs, outputs, i
    8·1 answer
  • Modify the sentence-generator program of Case Study so that it inputs its vocabulary from a set of text files at startup. The fi
    15·1 answer
  • Consider the following two code segments, which are both intended to determine the longest of the three strings "pea", "pear", a
    7·1 answer
  • 15. It is the process of capturing data or translating information to recording format
    12·1 answer
  • The hostel in which you plan to spend the night tonight offers very interesting rates, as long as you do not arrive too late. Ho
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!