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
Scrie un program care citind varstele a 2 copii afiseaza care dintre ei este cel mai mare si cu cat. Exemplu: Pentru varstele 5
murzikaleks [220]

Answer:

primul_copil = int(input("Introduceți vârsta primului copil: "))

aldoilea_copil = int(input("Introduceți vârsta celui de-al doilea copil: "))

def copilmai_mare(varsta1, varsta2):

   if varsta1 > varsta2:

       diferenta = varsta1 - varsta2

       print("copilul mai mare este varsta1 cu diferența de vârstă de: ", diferenta )

   else:

       diferenta = varsta2 - varsta1

       print("copilul mai mare este varsta2 cu diferența de vârstă de: ", diferenta )

copilmai_mare(primul_copil, aldoilea_copil)

Explanation:

Programul python de mai sus definește o funcție "copilmai_mare" care ia două argumente "varsta1" și "varsta2". Diferența dintre vârstele copiilor este comparată, iar cel mai mare copil și diferența sunt tipărite pe ecran.

5 0
3 years ago
1.
Alecsey [184]
I think
The start and end shape
7 0
4 years ago
A digital clock on a small cooking appliance keeps time by?
IgorLugansk [536]
They typically use the 50-60 Hz oscillation of AC power or a 32,768 hertz Chrystal oscillator to keep time. <span />
5 0
3 years ago
Dragging a mouse over text is called
Fantom [35]

Answer:

typing

Explanation:

8 0
3 years ago
Which function key will help you find the word and replace
MaRussiya [10]

F5 key on your keyboard in word and power point if that is what you are referring to.


3 0
3 years ago
Other questions:
  • Two technicians are discussing amperage in a series circuit. Technician A states that adding resistors in series will decrease c
    13·1 answer
  • What are some examples for Environmental Technology?
    5·2 answers
  • A delimiter is used to do which of these? A. Separate two lines of data from each other. B. Separate two fields within a line of
    9·2 answers
  • 1. If you are 15% years old, you are old enough to obtain
    10·2 answers
  • The ____ command is used to disconnect a datatable object from the database. (
    15·2 answers
  • Research and discuss the LAMP (Linux, Apache, MySQL, and PHP) architecture. What is the role of each layer of this software stac
    14·1 answer
  • Which hexadecimal number is equivalent to the decimal number 11?
    13·1 answer
  • How can the use of new technology in industry benefit the us government
    8·2 answers
  • Is there anything I can do to fix my laptop? It is a chrome book and my school provided it. Everything is still working.If anyon
    14·2 answers
  • Match the features of a word processing software to their corresponding functions.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!