Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 9 Weeks Ago, 4 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I am struggling to finish the problem can someone please help
Purpose: Create a class name GasPrices. Its main() method holds an integer variable named pricePerBarrel to which you will
assign a value entered by a user at the keyboard. Create a method to which you pass pricePerBarrel. The method displays the
range of possible prices per gallon. For example, if gas is $120 per barrel, then the price at the pump should be betweenÂ
$4.20 and $4.80. Save the application as GasPrices.java
*/
import java.util.*;
public class GasPrices
{
public double perbarrel = 120;
public double pergallon_low = 4.20;
public double pergallon_high = 4.80;
public static void main (int pricePerBarrel)
{
Scanner s = new Scanner ( System.in );
System.out.print ( "pricePerBarrel : " );
double pricePerBarrel = s.nextDouble ();
System.out.printf
(Â
"pricePerGallon : %.2f to %.2fn",
getBecomes2 ( 120, 4.20, pricePerBarrel );
getBecomes2 ( 120, 4.80, pricePerBarrel );
)
}
}