1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GrogVix [38]
3 years ago
12

"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.)"
Computers and Technology
1 answer:
Anika [276]3 years ago
6 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       

       System.out.println("Enter the number of bottles and cans:");

       int numberOfbottles = in.nextInt();

       int numberOfcans = in.nextInt();

       System.out.printf("Bottles: %8d\n", numberOfbottles);

       System.out.printf("Cans:    %8d\n", numberOfcans);

}

}

Explanation:

Ask user to input the number of bottles and cans using Scanner class

Print the results so that the numbers to the right line up (Since we know that the numbers have at most 8 digits, we can use %8d in printf. Also, be aware that how printf statements are written so that the numbers line up)

You might be interested in
What is a good practice to remember when adding transitions to a presentation?
storchak [24]

Answer:

A. Use one type of transition throughout.

Explanation:

Edge 2021.

7 0
3 years ago
Read 2 more answers
Ruth-Anne has created a document. She wants page 3 and all the pages after it to be formatted with two columns.
sertanlavr [38]

The correct answer is D. Go to page 3, click Page Layout, click Columns, click two.

Explanation

When you want to make a digital document, one of the most recommended tools for its quality and ease is Microsoft Word. In this program, you can edit documents as you wish, change the font, the font size, the distance of the margins, among other options. One of the options offered by this program is to add two or more columns of text, to carry out this action it is necessary to go to the page where you want to put two or more columns (in the case of Ruth-Anne, page 3), then click Page Design, there a menu is displayed in which the Columns option is found, click this option and there it will give us the option to choose the number of columns that we want to put (in the case of Ruth-Anne two columns), this will make this and subsequent pages have this setting in two or more columns of text. Therefore, if Ruth-Anne needs to make these edits to her document, she must follow these steps. So the correct answer is D. Go to page 3, click Page Layout, click Columns, click two.

4 0
3 years ago
A user program executes in a __________ , in which certain areas of memory are protected from the user's use, and in which certa
gtnhenbr [62]

Answer:

User Mode

Explanation:

Programs Can be Executed in two modes namely:

  • <em>User Mode</em>
  • <em>Kernel Mode</em>

User Mode

In User mode, the executing program has no ability to directly access hardware or reference memory. Program running in user mode must delegate to system APIs to access hardware or memory. Due to the protection afforded by this sort of isolation, crashes in user mode are always recoverable. Most of the program running on your computer will execute in user mode.

Kernel Mode

In Kernel mode, the executing program has complete and unrestricted access to the underlying hardware. It can execute any CPU instruction and reference any memory address. Kernel mode is generally reserved for the lowest-level, most trusted functions of the operating system. Crashes in kernel mode are catastrophic; they will halt the entire PC.

4 0
3 years ago
Assume that an array of integers named a that contains exactly five elements has been declared and initialized. Write a single s
Alik [6]

array[0] = 2 * array[4];

5 0
3 years ago
Cylinder heads with four valves flow more air than those with two valves because they
Effectus [21]
Are able to hold more air
8 0
3 years ago
Other questions:
  • How to import any csv from internet in phyton 3 and R ?
    12·1 answer
  • The crash rate per mile is ..
    12·2 answers
  • Write a program that accepts a file name from the command line, then initializes an array with test data using that text file as
    6·1 answer
  • Of the measures of feasibility in the accompanying figure, ____ considers points such as "Does the proposed platform have suffic
    8·1 answer
  • Which of the following are breach prevention best practices?Access only the minimum amount of PHI/personally identifiable inform
    11·1 answer
  • Which user characteristic may not be used to change keyword bids in adwords?:?
    11·1 answer
  • Consider the following sequence of page references: 1 2 3 3 4 4 1 4 1 3 4. Determine how many page faults will occur with LRU(Le
    13·1 answer
  • Tom is trapped on the top floor of a department store. It’s just before Christmas
    13·2 answers
  • True or false, USBs are slower than RAM.
    15·1 answer
  • 1110011*110011 binary multiplication
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!