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
Write steps to Delete data from ‘Datagridview’
julsineya [31]

Explanation:

private void btnDelete_Click(object sender, EventArgs e)

{

if (this.dataGridView1.SelectedRows.Count > 0)

{

dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index);

}

}

8 0
3 years ago
1. Select the Volatile Memory *
fomenos

Answer:

1 no.

ram

2

harmful software to the computer

3

local area network

4

bit

5

ram

6

morris malware

7

hard disk drive

8

read only memory9

gigabyte

hope this will help u

6 0
3 years ago
Plsss help me<br><br>1)give 2 examples of systems that you use or see in your day-to-day life​
Gnoma [55]

Answer:

The modern world has numerous kinds of systems that influence daily life. Some examples include transport systems; solar systems; telephone systems; the Dewey Decimal System; weapons systems; ecological systems; space systems; etc.

5 0
2 years ago
New friends??? if you want to be my new friend go follow my gram
lord [1]

Answer:

what you need

only friends

4 0
3 years ago
Read 2 more answers
The carbon fixation reaction converts?​
Ainat [17]

Answer:

Photosynthetic carbon fixation converts light energy into chemical energy. Photosynthesis reduces the carbon in carbon dioxide from OSC = +4 to OSC = +1 in the terminal carbon in glyceraldehyde-3-phosphate, the feedstock for simple sugars, amino acids, and lipids.

3 0
3 years ago
Other questions:
  • Which of the following is not a job title associated with a career in visual and audio technology? master control operator produ
    9·1 answer
  • Which should you use to find a saved file?
    15·2 answers
  • 1. You have recently been hired by a leading firm, which provides information management solutions to large corporations. As a n
    12·2 answers
  • In the world of computing,accessibility MOST often refers to what
    12·1 answer
  • 19 dollar fortnite gift card
    14·2 answers
  • Which symbol would be used in a flowchart to represent a connection to another part of the flowchart
    5·1 answer
  • IF ANYONE ANSWERS YOUR QUESTION WITH SOMETHING LIKE THIS:
    10·2 answers
  • Create a list called courses containing the names of your current courses.
    9·1 answer
  • An IT security threat is anything that might cause serious harm to a computer system.
    9·1 answer
  • Help fast pls
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!