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

Write a program Gas.java that computes and displays the price a person will pay for gas at the gas station. The program takes th

ree command-line arguments: two double arguments referring to the price per gallon, and the number of gallons of gas, and one boolean argument referring to whether the person pays cash or credit (true for cash, false for credit). If the person pays with a credit card, there is an extra charge of 10% of the total price. Gas is never free. A person stopping to buy gas will always buy some amount of gas. Print the error message "Illegal input" if any of the double inputs is zero or negative, and end the program.
Computers and Technology
1 answer:
Tems11 [23]3 years ago
5 0

Answer:

double price, number, total;

boolean payment;

Scanner input = new Scanner(System.in);

System.out.print("Enter Amount of Gas: ");

price = input.nextDouble();

<em>I've added the full source file as an attachment.</em>

<em>Where I used comments to explain difficult line</em>

<em />

Explanation:

Download java
You might be interested in
Assume that printStars is a function that takes one argument and returns no value. It prints a line of N stars (followed by a ne
trasher [3.6K]

Answer:

printStars(35);

Explanation:

public class Question {

   public static void main(String args[]) {

     printStars(35);

   }

   public static void printStars(int numberOfStars){

       for(int i = 1; i <= numberOfStars; i++){

           System.out.print("*");

       }

       System.out.print("\n");

   }

}

7 0
3 years ago
Please help me and solution in c language​
salantis [7]
Ummmm the solution is ummm brb
3 0
2 years ago
Por qué no es tan común el uso de energías mas amigables con el medio ambiente en el país donde vives?
Effectus [21]

Answer:

Explanation:

English:

All forms of electricity generation have an environmental impact on our air, water, and land, but it varies. Of the total energy consumed in the United States, about 40% is used to generate electricity, making electricity use an important part of each person’s environmental footprint.

Producing and using electricity more efficiently reduces both the amount of fuel needed to generate electricity and the number of greenhouse gases and other air pollution emitted as a result. Electricity from renewable resources such as solar, geothermal, and wind generally does not contribute to climate change or local air pollution since no fuels are combusted.

The fuel mix for U.S. electricity generation

The chart below shows that most of the electricity in the United States is generated using fossil fuels such as coal and natural gas. A small but growing percentage is generated using renewable resources such as solar and wind.

Spanish:

Todas las formas de generación de electricidad tienen un impacto ambiental en nuestro aire, agua y tierra, pero varía. Del total de energía consumida en los Estados Unidos, alrededor del 40% se usa para generar electricidad, lo que hace que el uso de electricidad sea una parte importante de la huella ambiental de cada persona.

Producir y usar electricidad de manera más eficiente reduce tanto la cantidad de combustible necesario para generar electricidad como la cantidad de gases de efecto invernadero y otra contaminación del aire emitida como resultado. La electricidad de recursos renovables como la energía solar, geotérmica y eólica generalmente no contribuye al cambio climático ni a la contaminación del aire local, ya que no se queman combustibles.

Combustible para la generación de electricidad en EE. UU.

El cuadro a continuación muestra que la mayor parte de la electricidad en los Estados Unidos se genera utilizando combustibles fósiles como el carbón y el gas natural. Un porcentaje pequeño pero creciente se genera utilizando recursos renovables como la solar y la eólica.

5 0
3 years ago
What is the value of: 1 + int(3.5) / 2?<br> Select one:<br> a. 2<br> b. 2.25<br> C. 2.5<br> d. 3
Drupady [299]

Answer:

C (2.5)

Explanation:

int(3.5) = 3

So, using order of operations, (3/2)+1=2.5

8 0
2 years ago
What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is
BigorU [14]

Answer:

Option D is correct.

Explanation:

Option D is correct because  when the condition  if (list[j] < temp) is tested it only gets true when element in list[] array at <em>jth</em> position is less than the value in <em>temp</em> and after that it increments the value of c by this statement: c++ and so c is incremented from 0 to as much times as much elements in list[] are lesser than temp.

6 0
3 years ago
Read 2 more answers
Other questions:
  • To display or distribute information from a database, programmers or database administrators create ___ .
    12·1 answer
  • Which type of object is used to organize and store data in Microsoft access 2013
    5·2 answers
  • Shortcuts can help you complete spreadsheet tasks more efficiently. True False?
    7·2 answers
  • What does it mean to read visual and audio text
    7·1 answer
  • Many computer programs contain ____ that detail the specific instructions a computer should perform (in a specific order) to car
    9·1 answer
  • The __________ method can determine whether a string contains a value that can be converted to a specific data type before it is
    12·1 answer
  • What is the name of the newer communication protocol that is supported by Window 10's version of TCP/IP?
    11·1 answer
  • Help giving points mark BRAINLEST
    5·1 answer
  • For a parking payment app, what option would MOST likely connect a user to a third party/external gateway?
    10·1 answer
  • In cryptocurrency, a block is only considered valid if it has a.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!