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
You want to store, organize, and manipulate your photos. what type of software do you need?
ohaa [14]

Answer:

You want to store, organize, and manipulate your photos. what type of software do you need?Adobe photoshop

sub heading:

what is photoshop?

Explanation:

1. you can dream it, you can make it with Adobe Photoshop.

2. Create beautiful images, graphics, paintings, and 3D artwork on your desktop or iPad

Reference link:

https://brainly.com

Hashtag:

#SPJ4

3 0
1 year ago
Trying to make the baseplate red and turn off can collide then the game waits 5 seconds and turns on can collide, making the bas
kenny6666 [7]

Answer:

Explanation:

yes

but dont forget to call makeBasePlateGreen

maybe you would call it at the end of the program?

by the way you have a typo at the end

make the O lowercase

myBlasePlate.BrickColor = BrickColor.Green()

and then add this to the end

makeBasePlateGreen()

so you call the function and actually use it.

4 0
2 years ago
TRUE/FALSE: In order to use an object in a program, its class must be defined.
FinnZ [79.3K]
Yes that is correct. True
3 0
3 years ago
To make a complicated task easier, use a _____.
tia_tia [17]
I believe the answer is B spread sheet because i use spread sheets to make my life easier. I organize info in a spread sheet then it is really easy to find.

hope this helps<span />
6 0
3 years ago
What did the strict study generally find about the effect of internet use on sleep?
rjkz [21]
A. should be the answer hope this helps :)
4 0
3 years ago
Read 2 more answers
Other questions:
  • Which of these is an on-site metric for social media marketing?
    13·1 answer
  • Which of the following information security technology is used for avoiding browser-based hacking?
    11·2 answers
  • Write statementsto show how finding the length of a character array char [ ] differs from finding the length of a String object
    9·1 answer
  • If your network subnet mask is /16, what is the maximum number of host ids available for this network?
    15·1 answer
  • OSHA requires training for employees on the hazards to which they will be exposed.
    12·2 answers
  • You have dinner with your family and tell them that you have taken bcis. your mother tells you that she is proud of you and that
    9·1 answer
  • Write the definition of a function reverse, whose first parameter is an array of integers and whose second parameter is the numb
    15·1 answer
  • A company is developing a smart TV that connects to a wireless home network. Which technology can best help to establish this co
    11·2 answers
  • Which is an example of an operating system? (5 points)
    5·1 answer
  • Who plays warzone im a roze sweat and ill try to carry with loadout
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!