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
Q.drtrdyudoijoemrkdf
sveta [45]

Answer:

Yes

Explanation:

8 0
2 years ago
Read 2 more answers
2) A ________ uses electronic memory and has no motors or moving parts. A) mechanical hard drive B) solid-state drive C) Blu-ray
grin007 [14]

Answer:

A.mechanical hard

Explanation:

brainliest me and follow ty

7 0
2 years ago
You are building a gaming computer and you want to install a dedicated graphics card that has a fast GPU and 1GB of memory onboa
Vilka [71]

Answer:

a. PCI express

Explanation:

<em>PCI express</em> (Peripheral Component Interconnect Express) is a high speed serial bus and commonly used motherboard interface for  Graphics card, wifi, SSDs and HDs hardware connections. Simple PCI can also be used but PCI express has more error detection accuracy lesser number of I/O pins and better throughput as compared to simple PCI.

6 0
3 years ago
Sergio knows that to meet the project requirements, it is essential to have
zhenek [66]

Answer:

I need a better explanation??

4 0
3 years ago
How many owners does a sole proprietorship have?
never [62]
The sole proprietorship it is the simplist business form under which one can operate a business. the answer is one.
8 0
3 years ago
Other questions:
  • A user is claiming a host can be reached via the IP address but not through the name. What should a technician do first to resol
    13·1 answer
  • What can you use with your keywords to narrow your search if you complete an internet search using a search engine and do not ge
    15·2 answers
  • Create a detail report that will display all SCR courses in alphabetical order, with the course name and the instructor name in
    5·1 answer
  • Which speaker port should you use when connecting a single speaker to a pc?
    6·1 answer
  • "A user reports that the corporate web server cannot be accessed. A technician verifies that the web server can be accessed by i
    8·1 answer
  • Why won't Brainly let me send a link? This is just du*mb! I want to send good articles explaining a content, and this site just
    5·1 answer
  • How to make a website
    15·2 answers
  • What is the purpose of the ISOWEEKNUM function? determines how many workdays are in a certain week determines how many workdays
    12·2 answers
  • If there are over 1,000 websites about a certain topic, the information is reliable. A. True B. False
    12·1 answer
  • A vlan ________.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!