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
PLEASE HELP I WILL REWARD YOU
xxMikexx [17]
What what what what what what
5 0
3 years ago
Substance abuse is an _____ coping mechanism.
hichkok12 [17]
Mental coping mechanism.
7 0
3 years ago
Convert the following numbers. (Please show all steps; no marks will be awarded if no steps are shown) [1.5 x 4 = 6 marks]
katen-ka-za [31]

Answer:

i. 10210212

ii. 100 101 001 in BASE 2

iii. 46.4631

iv. 12.453125

Explanation:

i. Converting to base 10 we get

=  10 x 162 + 13 x 161 + 9 x 160 = 2777

Converting to base 10 we get  =

2777/3 = 925 with remainder 2

925/3 = 308 with remainder 1

308/3 = 102 with remainder 2

102/3 = 34 with remainder 0

34/3 = 11 with remainder 1

11/3 = 3 with remainder 2

3/3 = 1 with remainder 0

1/3 = 0 with remainder 1

Hence the Answer is 10210212

ii. = Octal is taken in pair of 3 bits , Writing binary of each number in 3 bits we get  = 100 101 001 in BASE 2

iii. = 1 x 52 + 2 x 51 + 3 x 50 + 3 x 5-1   = 38.6 in decimal

Converting to Octal we get

38 /8 = 4 with remainder 6

4 /8 = 0 with remainder 4

.6 x 8 =  4.8

.8 x 8 = 6.4

46.4631

iv. = 1x 81 + 4 x 80 + 3 x 8-1 + 5 x 8-2   = 12.453125

Check here for Free courses about IT and Management www.eacademy.lk

4 0
3 years ago
you are troubleshooting an inkjet printer . users report that the printer is printing in the wrong colors. the problem just star
monitta

The likely cause of the printer printing in the wrong colors includes:

  • Ink cartridges installed in the wrong spot
  • leaking ink cartridges

<h3>What is a inkjet printer?</h3>

This refers to a computer peripheral that produces hard copies of a text document or photo by spraying droplets of ink onto paper.

In conclusion, the likely cause of the printer printing in the wrong colors includes ink cartridges installed in the wrong spot and leaking ink cartridges.

Read more about inkjet printer

brainly.com/question/4962501

#SPJ4

6 0
2 years ago
Who invented the touchscreen? When and which company makes it?
docker41 [41]

Answer:

Eric A. Johnson

The first touchscreen was invented in 1965 by Eric A. Johnson who worked at the Royal Radar Establishment in Malvern, England. His first article, "Touch display—a novel input/output device for computers" describes his work and features a diagram of the design. 1982.

4 0
3 years ago
Other questions:
  • Briefly explain the following terms and concepts:
    8·2 answers
  • Digital dashboards provide the decision makers with a quick overview of key performance indicators and other key operational sta
    13·1 answer
  • A ____ is a device that interconnects two or more workstations in a star-wired bus local area network and immediately retransmit
    9·1 answer
  • Please select the word from the list that best fits the definition
    8·2 answers
  • Click this link to view O NET'S Wages and Employment section for Film and Video Editors.
    11·2 answers
  • What is the first thing you should do to find a mean and range of data?
    14·1 answer
  • Missy loves her old Windows games. When she upgrades her Windows system, the games run fine, but the output looks fuzzy since th
    15·1 answer
  • Role of memory in a computer system
    10·1 answer
  • Two girls were born to the same mother, on the same day, at the same time, in the same month and the same year and yet they're n
    7·1 answer
  • What is the definition of a nested function?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!