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
Anna71 [15]
3 years ago
10

Write an application that inputs a five digit integer (The number must be entered only as ONE input) and separates the number in

to its individual digits using MOD, and prints the digits separated from one another. Your code will do INPUT VALIDATION and warn the user to enter the correct number of digits and let the user run your code as many times as they want (LOOP). Submit two different versions: Using the Scanner class (file name: ScanP2)
Computers and Technology
1 answer:
netineya [11]3 years ago
8 0

Answer:

The program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 int n, num;

 Scanner input = new Scanner(System.in);

 System.out.print("Number of inputs: ");

 n = input.nextInt();

 LinkedList<Integer> myList = new LinkedList<Integer>();

 for(int i = 0; i<n;i++){

     System.out.print("Input Integer: ");

     num = input.nextInt();

     while (num > 0) {

     myList.push( num % 10 );

     num/=10;

     }

     while (!myList.isEmpty()) {

         System.out.print(myList.pop()+" ");

     }

     System.out.println();

     myList.clear();

 }

}

}

Explanation:

This declares the number of inputs (n) and each input (num) as integer

 int n, num;

 Scanner input = new Scanner(System.in);

Prompt for number of inputs

 System.out.print("Number of inputs: ");   n = input.nextInt();

The program uses linkedlist to store individual digits. This declares the linkedlist

 LinkedList<Integer> myList = new LinkedList<Integer>();

This iterates through n

 for(int i = 0; i<n;i++){

Prompt for input

     System.out.print("Input Integer: ");

This gets input for each iteration

     num = input.nextInt();

This while loop is repeated until the digits are completely split

     while (num > 0) {

This adds each digit to the linked list

     myList.push( num % 10 );

This gets the other digits

     num/=10;

     }

The inner while loop ends here

This iterates through the linked list

     while (!myList.isEmpty()) {

This pops out every element of thelist

         System.out.print(myList.pop()+" ");

     }

Print a new line

     System.out.println();

This clears the stack

     myList.clear();

 }

You might be interested in
Question 2/21
chubhunter [2.5K]

Answer:

True.

Explanation:

Bau team is struggling to complete their daily BAU work. If they look for another task which is Value Maximization Scrum then they will loose focus from the BAU work. The team will be confused between two tasks and will not be able to meet either commitments. It is better for them to focus on initial task only.

4 0
3 years ago
List and describe each of the activities of technology
jeyben [28]

Answer:

network has led to exposure of dirty things to young ones.

air transport has led to losing of lives

4 0
3 years ago
Over the last decade, the overall energy consumption of cloud data centers worldwide has remained relatively the same. Why is th
s2008m [1.1K]

Over the last decade, the overall energy consumption of cloud data centers worldwide has remained relatively the same because the technology supporting cloud data centers has become much more energy efficient.

<h3>Why has the energy consumption of cloud data centers remained the same?</h3>

The reason is that servers are said to be six times as heavy as data in terms of energy consumption is one that is seen to be due to improved hardware efficiency.

In regards to cloud, the machines are said to be  running by giving web services and other machines  room to consumes some level or amount of energy that can be used for working.

Hence, Over the last decade, the overall energy consumption of cloud data centers worldwide has remained relatively the same because the technology supporting cloud data centers has become much more energy efficient.

Learn more about cloud data centers from

brainly.com/question/13440433

#SPJ1

See full question below

Over the last decade, the overall energy consumption of cloud data centers worldwide has remained relatively the same. Why is this so? The technology supporting cloud data centers has become much more energy efficient. There is significantly less customer demand for cloud computing than a decade ago. Cloud providers have placed limits on the amount of data stored at each center. Cloud data centers operate with less computing power than they did in the past.

8 0
2 years ago
A formal log-on procedure is the operating system’s last line of defense against unauthorized access.
Elina [12.6K]
The answer is A. true
7 0
3 years ago
Super easy question but you have to think about it because it’s not that easy I’ll mark brainliest for first answer Explain the
kkurt [141]

Answer:

Databases are not that simple. Now we not only have a Data warehouse, but we also have the Data Lake as well. We also have NoSQL and SQL form of support with these modern databases. The JSON format is rocking. You can hence through JSON store the text, image, audio, video, etc in one go. And like the first five can be a text, the next five can be an image then again a text than video, and so on. And it is super easy to access them as well. Also, you can edit them quite easily as well. It's not that hard like the Lisp used to be in the past. And supermarket has a mix blend of the database. And modern databases like Data Lake can be very useful, undoubtedly.

You can store security type of requirements, like CCTV footage, each shop details like shop ID, Product list, shop type, electricity bill, hours of opening, floor, facilities, no. of employees, etc., and like this, we can have the details for the entire supermarket, and each shop there definitely. And we can perform various actions on behalf of each shop and market as well. The database can hence be very useful definitely

Explanation:

Please check the answer.

8 0
3 years ago
Other questions:
  • A Narrative Statement illustrates how your life will look when you reach a goal.
    15·2 answers
  • Consider the following constructor for an immutable matrix ADT:
    8·1 answer
  • Which of the following is a computerized job classification system that contains continually updated information regarding the k
    15·1 answer
  • Rick is linking different pages in his website. Match the value of the attribute to its meaning to enable Rick to choose the mos
    13·1 answer
  • After conducting interviews with several bad candidates, Althea, a manager at Langrover Inc. interviewed a candidate who was bet
    15·1 answer
  • Will mark brainliest! What does this code do? What kind of code is this called?
    15·1 answer
  • Can someone solve this for me please? It’s part of an escape room.
    13·2 answers
  • You are comparing cryptographic solutions to implement at your organization. Which two items should you focus on when you are ev
    12·1 answer
  • Class C Airspace inner ring begins at the __________ and extends vertically (by definition) to MSL charted values that generally
    5·1 answer
  • Why did Elena Gilbert Turn her humanity off when she was sired to Damon? (In The Vampire Diaries)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!