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
Name the contributions of Steve Jobs and Bill Gates, with respect to technology.
Sergio [31]

Answer: Steve Jobs made several contributions towards technology by introducing the range of Apple devices and technologies .he started the Apple Incorporation.The technologies introduced by his company are as follows:-

  • iPod
  • iPhone
  • Apple Lisa
  • iMac
  • iPad etc.

 Bill Gates is the founder of Microsoft incorporation and made a lot of development in that field to create various software for the operating system.the creation of "Microsoft Window" was started by him and some other contributions are as follows:

  • Windows 7
  • Windows 8
  • Vista
  • XP
  • windows 95 etc.
3 0
3 years ago
What is computer system ?​
Over [174]

Answer:

a system that is a computer

6 0
3 years ago
Read 2 more answers
Write your question here (Keep it clear and simple to get the best answer)
weeeeeb [17]
What is your favorite book?
4 0
2 years ago
Read 2 more answers
What is the best free game designing program for windows
Nadusha1986 [10]
Python, Unity 3D, C++Notepad
8 0
3 years ago
How can you tell if your car is overheating?
Nitella [24]
A) your temp gauge is moving into red
4 0
3 years ago
Read 2 more answers
Other questions:
  • Provide an example of a time in your personal or work life when you used the household measuring system and measured out an exac
    6·1 answer
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • Which finger types the return or enter key?
    6·2 answers
  • Which computer device is used to capture or copy a photograph to place in a report?
    14·1 answer
  • You are part of a team that is setting up a movie streaming service. The company is planning on initially making available 500 m
    8·1 answer
  • _____ are independent and not associated with the marketing efforts of any particular company or brand.​
    9·1 answer
  • Int a = 1; int b = 0; int c = -1; if ((b + 1) == a) { b++; c += b; } if (c == a) { a--; b = 4; }
    7·1 answer
  • In what situations might you need to use a function that calls another function?
    11·1 answer
  • How exactly do you find the circumference by using C++ Programming? I really need a specific answer.
    14·1 answer
  • The most important part of a computer​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!