Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.Scanner; / * * This program prints the price per ounce for a six - pack of cans. * / public class Volume 2
import java.util.Scanner;
This program prints the price per ounce for a sixpack of cans.
public class Volume
public static void mainString args
Read price per pack
Scanner in new ScannerSystemin;
System.out.printPlease enter the price for a sixpack: ;
double packPrice innextDouble;
Read can volume
System.out.printPlease enter the volume for each can in ounces: ;
double canVolume innextDouble;
Compute pack volume
final double CANSPERPACK ;
double packVolume canVolume CANSPERPACK;
Compute and print price per ounce
double pricePerOunce packPrice packVolume;
System.out.printfPrice per ounce: f pricePerOunce;
System.out.println;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started