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
Select the correct navigational path to freeze the top row of your worksheet. Select the panes you wish to freeze. Click the tab
Artemon [7]

Yeah, Your steps ar correct. Let's analyse those steps more easily by the following steps:

\Large{ \boxed{ \bf{ \color{aqua}{Freeze \: panes:}}}}

Freeze panes is a feature in spreadsheet applications, such as Microsoft Excel, LibreOffice Calc, and Google Sheets. It "freezes" a row or column, so that it is always displayed, even as you navigate the spreadsheet.

❍ Freezing panes is especially useful if your spreadsheet has a header row, that you want to always be visible.

  • Select the row below the row(s) you want to freeze. In our example, we want to freeze rows 1 and 2, so we'll select row.
  • Click the View tab on the Ribbon.
  • Select the Freeze Panes command, then choose Freeze
  • Panes from the drop-down menu. ...
  • The rows will be frozen in place, as indicated by the gray line.

<u>━━━━━━━━━━━━━━━━━━━━</u>

6 0
1 year ago
Read 2 more answers
3.14 LAB: Simple statistics for Python
Ad libitum [116K]

Answer:

Following are the correct python code to this question:

n1 = float(input('Input first number: '))#input first number  

n2 = float(input('Input second number: '))#input second number  

n3 = float(input('Input third number: '))#input third number  

n4 = float(input('Input fourth number: '))#input fourth number  

average = (n1+n2+n3+n4)/4 #calculate input number average

product = n1*n2*n3*n4 # calculate input number product

print('product: {:.0f}  average: {:.0f}'.format(round(product),round(average))) #print product and average using round function

print('product: {:.3f}  average: {:.3f}'.format(product,average)) #print product and average value

Output:

Please find the attachment.

Explanation:

The description of the above python code can be defined as follows:

  • In the above python program four variable "n1, n2, n3, and n4" is defined, in which we take input from the user end, and in these user inputs we use the float method, that converts all the input value in to float value.
  • In the next step, two variable average and product are defined, that calculate all input numbers product, average, and hold value in its variable.
  • In the last line, the print method is used, which prints its variable value by using a round and format method.

8 0
2 years ago
What are the two main functions of user accounts in Active Directory? (Choose all that apply.) Allow users to access resources m
irina [24]

Answer:

method for user authentication to the network

Provide detailed information about a user

Explanation:

An in AD, a user account consists of all the information that includes user names, passwords, and groups. All these information defines a domain user in which a user account has membership access to. With the advanced features of Kerbos, mutual authentication in user accounts to a service is achieved.

3 0
2 years ago
Read 2 more answers
4.17 LAB: Data File A comma separated value (.csv) file has been included to be used for this program. Each line contains two va
Andrej [43]

Answer:

import csv

def Csvreader(filename):

   with open("filename", "r") as file:

   content = file.csv_reader()

   list_content = list(content)

   file.close

   return list_content

Explanation:

This is a python description of the function that reads the csv file and converts it to a list, from the list, each item can accessed with its index and updated directly. Use this to draw the same conclusion for a java program.

7 0
1 year ago
Which type of address is used at the transport layer to identify the receiving application?
monitta

Answer:

Port number  is used at the transport layer to identify the receiving application

Explanation:

Transport layer is responsible for overall “end-to-end” communication. It provides communication service to the application process which might be running on “different hosts”.

TCP (Transmission Control Protocol) or UDP (User Data Protocol) is the protocol used in the Transport layer. The port number is essential so that the transport layer can carry packets to the right destination pointing to the right application.

A port number usually contains 16 bit integer. Normally this number will send along with the header. Port number plays a major role in Transport layer.

5 0
1 year ago
Other questions:
  • Open this link after reading about Ana's situation. Complete each sentence using the drop-downs. Ana would need a minimum of ato
    5·2 answers
  • An electronics store purchased a CD player at a wholesale price of $60 and then sold it at a 40 percent discount off the origina
    13·1 answer
  • Garrett wants to search through a csv file to find all rows that have either the name John or Bob in them and display them out t
    9·1 answer
  • Budget Analysis (use while loop) Write a program that asks the user to enter the amount that he or she has budgeted for a month.
    5·1 answer
  • Translate the following MIPS code to C. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3
    8·1 answer
  • A sine wave is offset 1/9 cycle with respect to time 0. What is its phase in degrees and radians? Which simple signal has a wide
    12·1 answer
  • For a class project, Jerome builds a simple circuit with a battery and three light bulbs. On his way to school, Jerome drops his
    9·1 answer
  • #Write a function called "replace_all" that accepts three #arguments: # # - target_string, a string in which to search. # - find
    11·1 answer
  • When drivers have no control over their driving environment and are stuck in traffic, the lack of control over the traffic event
    13·1 answer
  • 4.9 Code Practice: Question 4
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!