Question: Using Java Using the printf method, print the values of the integer variables bottles and cans so that the output looks like this: Bottles: 8

Using JavaUsing Java Using the printf method, print the values of the integer

Using the printf method, print the values of the integer variables bottles and cans so that the output looks like this:

Bottles: 8 Cans: 24

The numbers to the right should line up. (You may assume that the numbers have at most 8 digits.)

... 6. Using the printf method, print the values of the integer variables bottles and cans so that the output looks like this: Bottles: Cans: 8 24 The numbers to the right should line up. (You may assume that the numbers have at most 8 digits.) Output.java 1 import java.util.Scanner; 2. 3 public class Output 4 { 5 public static void main(String[] args) 6 7 Scanner in = new Scanner(System.in); 8 System.out.print("Please enter the number of bottles and cans: "); int bottles = in.nextInt(); 10 int cans = in.nextInt(); 11 System.out.printf(". "Bottles: ", bottles, "Cans: ", cans); 12 } 13 } CodeCheck Reset

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!