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
Furkat [3]
3 years ago
10

Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar co

st to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns 7.89975.
Computers and Technology
1 answer:
aleksklad [387]3 years ago
8 0

Answer:

public static double drivingCost(int drivenMiles, double milesPerGallon,double dollarsPerGallon){

       return (drivenMiles/milesPerGallon)*(dollarsPerGallon);

   }

Find a complete java program that prompts the user to enter this values and the calls this Method in the explanation section.

Explanation:

<em>import java.util.Scanner;</em>

<em>public class ANot {</em>

<em>    public static void main(String[] args) {</em>

<em>    Scanner in = new Scanner(System.in);</em>

<em>        System.out.println("Please Enter the Driven Miles");</em>

<em>        int drivenMiles = in.nextInt();</em>

<em />

<em>        System.out.println("Please Enter the Your fuel consumption in miles/gallon");</em>

<em>        double milesPerGallon = in.nextDouble();</em>

<em />

<em>        System.out.println("Please Enter the cost of fuel in Dollars/gallon");</em>

<em>        double dollarsPerGallon = in.nextDouble();</em>

<em />

<em>        double dollarCost = drivingCost(drivenMiles,milesPerGallon,dollarsPerGallon);</em>

<em>        System.out.println("The Total Cost in Dollars is "+dollarCost);</em>

<em>        }</em>

<em>    public static double drivingCost(int drivenMiles, double milesPerGallon,double dollarsPerGallon){</em>

<em />

<em>        return (drivenMiles/milesPerGallon)*(dollarsPerGallon);</em>

<em>    }</em>

<em>}</em>

You might be interested in
List four examples of soft and hard skills
emmainna [20.7K]

Answer:

Explanation:

soft skills

1 – Communication. ...

2 – Teamwork. ...

3 – Adaptability. ...

4 – Problem-Solving. ...

hard skills

Technical Skills

Computer Skills

Analytical Skills

Marketing Skills

8 0
3 years ago
Read 2 more answers
What is the best data type for traveling day?
kykrilka [37]
Here if its wrong sorry

7 0
2 years ago
Glass, rubber, porcelain, and paper are examples of electrical A. conductors. B. insulators. C. grounds. D. batteries.
irga5000 [103]
B.Insulators I think
7 0
3 years ago
Read 2 more answers
The ____ of a variable is the location in memory where it’s value is stored. A. Value B. Address C. Data type D. Number
fomenos

Answer: C. Data type

Explanation:

data types are defined as the data storage format that a variable can store a data to perform a specific operation. Data types are used to define a variable before its use in a program. Size of variable, constant and array are determined by data types.

3 0
3 years ago
Briefly summarize what vehicle forensics is.
Alenkinab [10]

Answer:

Vehicle forensics is a process that yields a myriad of data potentially helpful to all kinds of investigations, from law enforcement cases, to insurance fraud, to accident reconstruction. Many newer vehicles (generally 2008 and newer) are equipped with an infotainment system.

4 0
2 years ago
Other questions:
  • Help please?
    10·1 answer
  • A book of the Law was found in the Temple, which was being repaired, during what year of Josiah's reign.
    15·2 answers
  • ______ is the software that blocks a user from being able to access your computer.
    9·1 answer
  • Sedimentary rock formation occurs when igneous, metamorphic, or other sedimentary rocks are exposed to the unyielding forces of
    14·2 answers
  • If i'm wanting to use hydra on linux to crack a password and the issue regarding hashes occurs, what shall i do?
    12·1 answer
  • How is the cia triad used to evaluate encryption methods?
    6·1 answer
  • _______ data would be useful for creating a weekly status report for your manager that should reflect changes in real time.     
    10·2 answers
  • while investigating the settings on your SOHO router, you find two IP address reported on the devices's routing table, which is
    5·1 answer
  • Which is the fastest memory in computer​
    9·2 answers
  • A program that organizes sequences of automated provisioning tasks. A. Application Packager B. Sequence Manager C. Sequence Logg
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!