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
Which of the following is the best example of a manager with a delegator leadership style
Vera_Pavlovna [14]
I think the answer should be answer D.
8 0
3 years ago
Read 2 more answers
Antivirus software products require that you update _____ on a regular basis
german
Operating System, as far as I know @[email protected]
5 0
3 years ago
Read 2 more answers
1. What are the advantages and disadvantages of technology in communication?
Gennadij [26K]

Answer:

ADVANTAGES:

First, the evolution of technology is beneficial to humans for several reasons. At the medical level, technology can help treat more sick people and consequently save many lives and combat very harmful viruses and bacteria.

2-Technology has also increased the productivity of almost every industry in the world. Thanks to technology, we can even pay with bitcoins instead of using banks

DISADVANTAGES:

1-Lack of Privacy. You might think that a quick text or IM offers more privacy than a telephone call in a crowded room. ...

2-Distraction from Real Life. ...

3-Potential for Misunderstanding. ...

4-Decline of Grammar and Spelling...

5- Near people are far and far people are near through communication technology. we have no time to sit with our relatives but constantly communicate far away people . I think this is biggest <em>disadvantage </em>

Explanation:

7 0
3 years ago
Read 2 more answers
Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
Ilia_Sergeevich [38]
I think it is true (A) 
3 0
3 years ago
How important are operating system in our devices?​
TiliK225 [7]

Answer:

Explanation:

An operating system is the most important software that runs on a computer. ... It also allows you to communicate with the computer without knowing how to speak the computer's language. Without an operating system, a computer is useless.

6 0
2 years ago
Read 2 more answers
Other questions:
  • The tone a writer takes is referred to as the writing _____.
    7·2 answers
  • What is a custom information field that helps users to find a specific document?
    8·1 answer
  • What command limits structural changes, such as adding, deleting, or moving sheets, that can be made in a workbook?
    13·1 answer
  • Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, s
    11·1 answer
  • Only technical managers needs to know about programming, web view source code and about technology issues.
    12·1 answer
  • At Chicago Cubs games, residents across the street from Wrigley Field can watch the game from their apartment windows. Many of t
    14·1 answer
  • Write a program to output a big A like the one below
    12·1 answer
  • Who would win in a fight iron man or bat man​
    5·2 answers
  • When a collection of honeypots connects several honeypot systems on a subnet, it may be called a(n) honeynet
    9·1 answer
  • Which layer of the OSI model provides a user interface in the form of an entry point for programs to access the network infrastr
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!