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
The colors of the pixels in a digital image are often represented by red, green, and blue values
maw [93]

Answer:

Lossless Transformation

Explanation:

3 0
3 years ago
an images scanned from a CD cover does not have to be cited because you didn't find the image on the internet True or false
ruslelena [56]

Answer:

False

Explanation:

When searching on the internet, I found flashcards containing this information.

6 0
3 years ago
The page-replacement policy means that pages are not placed to make more space. A. True B. False
BabaBlast [244]

Answer:

B. False

Explanation:

A page-replacement policy can be defined as a set of algorithm that instructs the operating systems on what memory page is to be swapped, paged out or written to disk in order to allocate more memory as they're required by various active processes during virtual memory management.

Some of the algorithms or techniques used by the operating system for page-replacement policy are;

1. Last In First Out (LIFO).

2. First In First Out (FIFO).

3. Least Recently Used (LRU).

4. Least Frequently Used (LFU).

5. Optimal (OPT or MIN).

Hence, the page-replacement policy means that pages are placed to make more space and to minimize the total number of page that would be missing.

7 0
3 years ago
Which statement is true of arrays? A) Array elements cannot be reset after the array is declared. B) Only whole numbers can be s
vekshin1

Answer:  Option (D) is correct

Explanation:

Array subscripts are used for refereeing to a individual element in the array.It is created by subscript operator for naming it.It can define the value about location often element. Array subscript can contain whole numbers only.

  • Other options are incorrect because array can be reset,other number along with the whole numbers can get stored in array and it can take high execution time.
  • Thus, the correct option is option(D.)
7 0
4 years ago
Oliver’s night job at the university computing center is to change the tapes used for overnight data backups on the server. Whil
densk [106]

Answer:

Explanation:

Ollie’s thesis may not be backed up as reliably as he might wish. A backup program may pass over a file that is currently open for writing, as the state of the data in such a file may be indeterminate.

4 0
3 years ago
Other questions:
  • Write a program that will calculate the following function:
    14·1 answer
  • 14. What is the simplest way to permanently get rid of an unwanted file?
    9·1 answer
  • Which collaboration website is best suited for social collaboration? www.media.iearn.org/projects www.meetup.com www.quest.nasa.
    9·1 answer
  • Which of the following is a major difference between XSS attacks and remote code exploits?
    15·1 answer
  • If you used a peach as a model of an animal cell, what would the peach's skin represent? A.nucleus B.cell wall C.cytoplasm D.cel
    10·2 answers
  • Which of the following is not an example of a cyber crime?
    8·1 answer
  • If String str = "Computer Science";, then what is the value of str.substring(10);? ​
    6·1 answer
  • Write any two word processing software​
    11·1 answer
  • What is the difference between an html opening tag and a closing tag?.
    7·1 answer
  • Which command must you use at the command prompt to determine the names of the network interfaces (including the isatap interfac
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!