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
erastova [34]
3 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]3 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
(in python)Write a program that takes a date as input and outputs the date's season. The input is a string to represent the mont
alexgriva [62]

Answer:

free points boi

Explanation:

3 0
3 years ago
Select the correct text in the passage.
Len [333]

Answer:

The appropriate guidelines to create and manage files in the passage:

O.  First, (select a central location to organize all your files, folders, and sub-folders).

O.  Then double-click the folder or folders to identify which file you want to move.

O.   Now (use Windows Explorer to navigate and paste the file in the

required location).

The correct text in the passage is:

O.   It is a great idea to (categorize your data into folders.) It is even better to (segregate them further into sub-folders.) If you maintain a list of  sub-folders under every main folder, you will be able to access all your tasks easily. For example, you could put your school subjects under  different sub-folders to organize your data efficiently on your computer.

Explanation:

8 0
3 years ago
Exercise 2:in many cinemas today audiences watch advertisements before the feature film begins, what kinds of ads would you expe
e-lub [12.9K]

Answer:

we see advertisements before feature of film begins.expected ads are:

it must be good for us physically and mentally.

which must be helpful,motivate us.which makes us honest kind and loving.I hate advertisements of video game.it is just waste of time

4 0
3 years ago
KM typically means the same thing across different types of businesses.
Gennadij [26K]

Answer:

If this is a true or false question, I believe the answer is the answer is false

Explanation:

3 0
3 years ago
Read 2 more answers
A security engineer is configuring a system that requires the X.509 certificate information to be pasted into a form field in Ba
zavuch27 [327]

Answer:

PFXB

Explanation:

3 0
3 years ago
Other questions:
  • What does the octal number 362 represent in the decimal system?
    13·1 answer
  • You enter the show ipv6 route command on an ospf device and the device displays a route. which conclusion can you draw about the
    14·1 answer
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    8·1 answer
  • While traditionally employers used computers to track ordering and inventory, computers are used now to
    11·1 answer
  • The following program segment is designed to compute the product of two nonnegative integers X and Y by accumulating the sum of
    9·1 answer
  • Program MATH_SCORES: Your math instructor gives three tests worth 50 points each. You can drop one of the test scores. The final
    7·1 answer
  • 30 points
    7·1 answer
  • 2 4. What is one way to prepare for building a project budget? (1 point)​
    9·1 answer
  • If someone has the IP address 127.0.0.1 and tries to connect to the address 127.255.252.255, which are they attempting to connec
    8·1 answer
  • Fill the labels!! Please quickly I need help quickly
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!