Create an applet that computes the user’s gasoline cost. You will need text fields where the user will enter the number of miles traveled by highway, the number of miles of city driving, the average fuel consumption of the vehicle for both highway and city driving, given in miles per gallon, and the cost of gasoline per gallon. Initially, fill these fields with the values 2000, 10000, 30, 20, and 3, respectively. Your applet should have a Compute Cost button that, when clicked, causes the cost to the displayed in a label.

What will be an ideal response?


See the code in GasCostApplet.java.

Computer Science & Information Technology

You might also like to view...

The ________ helps ensure that messages are properly routed from sender to receiver and that the messages arrive intact.

a) Internet Protocol (IP) b) The Ethernet standard c) HyperText Markup Language (HTML) d) Transmission Control Protocol (TCP)

Computer Science & Information Technology

The method distance vector protocols use to prevent packets from endlessly circulating around a routing loop is called ____________________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

A program that tracks the Web sites that you visit and then sends you advertisements that match your interests is called a(n):

A) ad-tracker B) adware C) worm D) virus

Computer Science & Information Technology

Which of the following is NOT an automatic way for Windows 7 to arrange your windows on the desktop?

A) Cascading B) Vertically stacked C) Side by side D) Horizontally stacked

Computer Science & Information Technology