Write a program Gas.java that computes and displays the price a person will pay for gas at the gas station. The program takes three 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.

Answers

Answer 1

Answer:

double price, number, total;

boolean payment;

Scanner input = new Scanner(System.in);

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

price = input.nextDouble();

I've added the full source file as an attachment.

Where I used comments to explain difficult line

Explanation:


Related Questions

Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" answer?

Answers

Answer:

yes it can

Explanation:

Computers cannot evaluate an expression to be between true or false.

Expressions in computers are represented in boolean values; i.e. they can only take one of two values (either true or false, yes or no, 1 or 0, etc.)

Take for instance, the following expressions will be evaluated to true, because the expressions are true.

[tex]\mathbf{1 + 2 = 3}[/tex].[tex]\mathbf{5>4}[/tex].[tex]\mathbf{4 + 4 <10}[/tex]

The following expressions will be evaluated to false, because the expressions are false.

[tex]\mathbf{1 + 2 > 3}[/tex].[tex]\mathbf{5=4}[/tex].[tex]\mathbf{4 + 4 >10}[/tex]

The above highlights show that, a computer cannot evaluate expressions to another value other than true or false

Read more about computer expressions at:

https://brainly.com/question/17500565

Select all that apply.
In the File tab, you can:
send documents as e-
mail attachments
post documents as blogs
export documents as PDF/XPS
record document macros

Answers

Answer:

send documents as e-mail attachments

post documents as blogs

export documents as PDF/XPS

D
E
A
C
B
For this lab, you will find the area of an irregularly shaped room with the shape as shown above.
Ask the user to enter the values for sides A, B, C, D, and E and print out the total room area.
Remember the formula for finding the area of a rectangle is length width and the area of a right triangle is 0.5 * the base" heigh
Please note the final area should be in decimal format.
Sample Run
Enter side A: 11
Enter side B: 2
Enter side C: 4
Enter side D: 7
Enter side E: 1
Sample Output
Room Area: 53.5

Answers

In python:

a = float(input("Enter side A: "))

b = float(input("Enter side B: "))

c = float(input("Enter side C: "))

d = float(input("Enter side D: "))

e = float(input("Enter side E: "))

print(f"Room Area: {(a * b) + ((a - c) * (d - (b + e))) + (0.5*(a - c) * e)}")

I hope this helps!

Which of the following is the primary benefit of becoming a member in the Dramatists Guild of America?


group health insurance

free legal advice

standard salary

networking opportunities

Answers

Answer:

networking opportunities

Explanation:

  The Dramatists Guild of America does offer playwrights legal advice and information on establishing royalties. However, the primary benefit of membership in the DG is networking opportunities. Playwriting is a limited field, and networking opportunities are essential for work.

Which shape is used as a start or end?
a paralleogram
a rounded rectangle
a rectangle
a diamond

Answers

Answer:

rounded rectangle

Explanation:

I jus looked it up lol

In an "and" operator only ONE value has to be true to activate the if block
Yes or No
(Scratch Coding)

Answers

If the "and" operator is present, BOTH conditions must be True in order for the if block to be activated.

Answer:

No

Explanation:

In one to two sentences, describe how to create a new tab.

Answers

Answer:

First you could move your cursor to the right and click on the button that looks like this +    

Or you can press ctrl+T and make a new tab

Explanation:

Hope this help you!

Describe in 2-4 sentences how you would select a function on a spreadsheet.

Answers

Answer:

Explanation:

You would call the capacity from the primary. At that point execute your own factors to it. When the capacity is in the cell, you can copy and after that paste it into another cell to do a similar capacity for that diverse scope of cells.

You would call the capacity from the primary. At that point execute your own factors to it. When the capacity is in the cell, you can copy and after that paste it into another cell to do a similar capacity for that diverse scope of cells.

What is spreadsheet?

A spreadsheet is a type of computer program used for organizing, calculating, analyzing, and storing data in tabular form. Spreadsheets were created as digital counterparts to traditional paper accounting spreadsheets.

The data entered into a table's cells is what the program uses to run. Each cell may include text, numeric data, or formula results that automatically calculate and display values based on the contents of neighboring cells.

Users of spreadsheets can change any stored value and watch the changes in calculated values. This enables quick investigation of numerous scenarios without the need for manual recalculation, making the spreadsheet helpful for "what-if" study.

Therefore, You would call the capacity from the primary. At that point execute your own factors to it. When the capacity is in the cell, you can copy and after that paste it into another cell to do a similar capacity for that diverse scope of cells.

To learn more about Spreadsheet, refer to the link:

https://brainly.com/question/8284022

#SPJ3

D
E
A
C
B
For this lab, you will find the area of an irregularly shaped room with the shape as shown above.
Ask the user to enter the values for sides A, B, C, D, and E and print out the total room area.
Remember the formula for finding the area of a rectangle is length width and the area of a right triangle is 0.5 * the base" heigh
Please note the final area should be in decimal format.
Sample Run
Enter side A: 11
Enter side B: 2
Enter side C: 4
Enter side D: 7
Enter side E: 1
Sample Output
Room Area: 53.5

Answers

In python:

a = float(input("Enter side A: "))

b = float(input("Enter side B: "))

c = float(input("Enter side C: "))

d = float(input("Enter side D: "))

e = float(input("Enter side E: "))

print(f"Room Area: {(a * b) + ((a - c) * (d - (b + e))) + (0.5*(a - c) * e)}")

I hope this helps!

What is the purpose of an IP address?
A identifying source and destination of data
B. creating images on websites
C. drawing tables on a spreadsheet
D. arranging packets of data correctly

Answers

pretty sure the answer is A!

What is the shortcut key to launch the Macros dialog box?
A. Alt+F7
B. Alt+F8
C. Ctrl+F8
D. Ctrl+F7

Answers

Answer:

On excel, Ctrl + F8 is the shortcut for the Macros dialog box

Explanation:

Answer:

Alt +F8

Explanation:

edge 2022

A company hires Brandon, a software engineer. Brandon is asked to work on a project with others in order to meet a tight deadline. He finds himself in weekly meetings to discuss the direction and status of the project, but most of his time is spent creating code. What is Brandon's specialization?

system management
system support
system collaboration
system development

Answers

Answer:

System developement

Explanation:

he is creating code, which is devloping the system.

Give me 2 examples of Monthly Cash Inflow: (2 points) *

Answers

Answer:

cash payments for goods and services; merchandise; wages; interest; taxes; supplies and others.

Explanation:

Answer:

1. Key cash flow drivers should be modeled explicitly.

In our example, a retail store business should start with the number of stores it plans to operate each month, then build up from there, based on the number of square feet and sales per square foot.  This will help the business to compute its revenue.

2. Inputs should only need to be input once.

It is important to group all inputs in the assumptions section so users can easily find, add, and modify them.

Explanation:

Helpppppp What is telnet?
internet protocol that allows one to access newsgroups
internet protocol that is the foundation for online data communication
internet protocol that connects to a computer remotely
internet protocol that loads a local file from a network onto a computer

Answers

C. internet protocol that connects to a computer remotely

During active listening, which response is NOT an example of providing feedback to the speaker to show that you understand his or her thoughts?
A.
nodding your head
B.
turning your back to the speaker
C.
saying, "You're saying that his reaction made you feel appreciated?"
D.
saying, "Sorry to interrupt, but can you explain that part again?"

Answers

Answer:

The answer is D.

Explanation:

They/you are asking the speaker to clarify what they just said.

Answer:

B. turning your back to the speaker

Explanation:

Plz plz plz help QUICKLY idk the answer and I really need help

Answers

Answer:

productivity is the correct answer

You have a friend that says she is interested in going into web development. She is very knowledgeable in terms of technology and digital media, but she is not sure if she has the personality and character traits that would help her succeed in the job. She knows that you are educated in this area, so she has come to you for help. What questions would you ask her to determine whether or not she has the necessary traits to be a good candidate for a career in web development? Keep in mind at least three important traits that a web developer should have.

Answers

Answer:

She should be aware several social media spectators are going to watch her content. She will get exposed on the Internet.

Explanation:

She should be aware several social media spectators are going to watch her content. She will get exposed on the Internet.

She should think before saying anything as one of his fans may complaint about her content to the police if she makes a joke about shooting up a place.

She has to be careful with his words as this may lead to termination from the job.

Is she a patient person? The customer might nitpick little things and make her change them or make her redo the entire website completely multiple times. If she's not patient it'll be difficult for her to handle customers like that.

Is she really good at listening to others? She'll need to be good at following instructions and listening to what people want to creat what they want easier.

Is she detail oriented? If she is not then it's likely she won't mind if her work is kind of sloppy but the customer is highly likely to complain, resulting in punishment from her employer.

hope this helps!

I need to identify what this building is

Answers

Answer:

its American building name annismous building

Where do i go to find questions to answer
13 points if you can help me PLz

Answers

Answer:

if you are on a phone there should be a Answer tab at the bottom in the middle next to influence but if you are on a computer go to the Brainly home page and scroll down to the bottom (not all the way) and there should be some questions to answer

does anyone know what type of Honda this is and the year of it lol this isn’t school related

Answers

my car guy boyfriend said that he thinks its a van due to the space and its definitely a newer Honda but not sure what year. he said don't quote him on it  tho lol

Even after charging your smartphone for several hours, it still appears completely turned off and will not tum on What should you try next to restore it
to health?
A.)submerge it in a bag of rice for 24 hours
B.)perform a hard reset
C.)perform a soft reset
D.)plug it into a charger for another hour

Answers

B. Perform a hard reset. Hold home and power I think.

Answer:

C: perform a soft reset

Explanation:

Just took the test, got 100.

Which term means a session-level protocol that is fast and efficient but has no means for error control or acknowledgment?

QoS

frame

TCP/IP

UDP

Answers

Answer:

UDP

Explanation:

User Datagram Protocol: a session-level protocol that is fast and efficient but has no means for error control or acknowledgment (UDP)

Also just took it on edj.

A session-level protocol that is fast and efficient but has no means for error control or acknowledgment is known as the term UDP.

What is UDP?

UDP is the acronym for User Datagram Protocol. It is defined as the protocol that is used for time sensitive applications but it's non-reliable because delivery of data to the destination cannot be guaranteed in UDP ( that is, has no means for acknowledgment)

Therefore, a session-level protocol that is fast and efficient but has no means for error control or acknowledgment is known as the term UDP.

Learn more about UDP here:

https://brainly.com/question/5660386

#SPJ2

Translate the following code into hexidecimal and to octadecimal


....
110000100111000011001100111

Answers

Answer:

1

Explanation:

me want brainliest pwease

Which of the following is true of how computers represent numbers

A. Using a fixed but large number of bits can eliminate the possibility of round off error when repressing numbers in binary
B. With a fixed number of bits some numbers are too large to represent in a computer which will lead to overflow errors.
C. Using a fixed but larger number of bits, for example 128, eliminates the possibility of overflow errors.
D. With a large but fixed number of bits it is possible to eliminate either round-off errors or overflow errors, but not both.

Answers

Answer: C. Using a fixed but large number of bits, for example 128, eliminates the possibility of overflow errors.

Explanation:

Computer as an intelligent device can only be able to represent inputs through conversion to readable machine language before it becomes output. In order to do this, there is a need to convert those inputs into bits and bytes. The converted input is then brought out as a readable format on the computer screen.

What era did the television occurred in

Answers

Answer:

roughly from the late 1940s through the late 1950s.

Explanation: hope this helps :)

Answer:

The first Golden Age of Television is the era of live television production in the United States, roughly from the late 1940s through the late 1950s.

Explanation:

Fill in the blank to give the result of each operation.
2 * 5 =

4 ** 3 =

7 / 2 =

17 % 3 =

Answers

Answer:

2 * 5 =10

4 ** 3 =64

7 / 2 =3.5

17 % 3 =2

Explanation:

I just got them all correct :) good luck

The result from each operation from each operation of the mathematical calculations are 10, 64, 3.5, and 0.51.

What is the mathematical calculations?

Counting, calculating, and grouping objects in simple math information and commercial activities were among the mathematical calculations. Simple math facts and operations can be counted and computed using this formula.

The correct fill in the blanks are:

2 × 5 = 104 ** 3 = 64 (Cube of 4)7 / 2 = 3.517 % 3 =0.51

Therefore, the mathematical calculations made the calculations easier, and it is a time saver.

Learn more about the mathematical calculations, refer to:

https://brainly.com/question/11790473

#SPJ2

What is calculated first in this formula: =A5*(A7+A10)+A14​

Answers

Answer:

The equation in parenthisis , you always calculate first

Given integer values for red, green, and blue, subtract the gray from each value.

Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus

(255, 0, 0) is bright red, (130, 0, 130) is a medium purple,(0,0,0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50,

130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray).

Given values for red, green, and blue, remove the gray part.

Answers

Answer:

Here is the C++ program:

#include <iostream>   //to use input output functions

using namespace std;   //to identify objects cin cout

int main() {   //start of main method

int red,green,blue,smallest;   //declare variables to store integer values of red,green, blue and to store the smallest value

cout<<"Enter value for red: ";  //prompts user to enter value for red

cin>>red;  //reads value for red from user

cout<<"Enter value for green: ";  //prompts user to enter value for green

cin>>green;  //reads value for green from user

cout<<"Enter value for blue: "; //prompts user to enter value for blue

cin>>blue;   //reads value for blue from user

//computes the smallest value

if(red<green && red<blue) //if red value is less than green and blue values

smallest=red;   //red is the smallest so assign value of red to smallest

else if(green<blue)   //if green value is less than blue value

smallest=green;   //green is the smallest so assign value of green to smallest

else  //this means blue is the smallest

smallest=blue;  //assign value of blue to smallest

//removes gray part by subtracting smallest from rgb

red=red-smallest;  //subtract smallest from red

green=green-smallest;  //subtract smallest from green

blue=blue-smallest;  //subtract smallest from blue

cout<<"red after removing gray part: "<<red<<endl;  //displays amount of red after removing gray

cout<<"green after removing gray part: "<<green<<endl;  //displays amount of green after removing gray

cout<<"blue after removing gray part: "<<blue<<endl;  } //displays amount of blue after removing gray

Explanation:

I will explain the program using an example.

Lets say user enter 130 as value for red, 50 for green and 130 for blue. Sp

red = 130

green = 50

blue = 130

First if condition if(red<green && red<blue)   checks if value of red is less than green and blue. Since red=130 so this condition evaluate to false and the program moves to the else if part else if(green<blue)  which checks if green is less than blue. This condition evaluates to true as green=50 and blue = 130 so green is less than blue. Hence the body of this else if executes which has the statement: smallest=green;  so the smallest it set to green value.

smallest = 50

Now the statement: red=red-smallest;  becomes:

red = 130 - 50

red = 80

the statement:  green=green-smallest;  becomes:

green = 50 - 50

green = 0

the statement: blue=blue-smallest; becomes:

blue = 130 - 50

blue = 80

So the output of the entire program is:

red after removing gray part: 80                                                                                                 green after removing gray part: 0                                                                                                blue after removing gray part: 80

The screenshot of the program along with its output is attached.

i need help with this fast, thank you sm if you help me. ill give you brainliest

Answers

Answer:

Red

Explanation:

What are the two reasons we analyze algorithms?

Answers

Answer:

the most straightforward reason for analyzing an algorithm is too discover its characteristics in order to evaluate its suitability for various applications or compare it with other algorithms for the same application