Write an application that inputs a five digit integer (The number must be entered only as ONE input) and separates the number into 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)

Answers

Answer 1

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();

 }


Related Questions

Used for monitoring web activity by users to make sure that sensitive information won't leave the building.

A, Web server
B, FTP server
C, POP server
D, Proxy server ​

Answers

Answer: PROXY

Explanation:

The basic objective of the web server is to store, process and deliver web pages to the users.

FTP server is to allow users to upload and download files. An FTP server is a computer that has a file transfer protocol (FTP) address and is dedicated to receiving an FTP connection. FTP is a protocol used to transfer files via the internet between a server (sender) and a client (receiver)

pop provides access via an Internet Protocol (IP) network for a user client application to a mailbox (maildrop) maintained on a mail server

proxy server is a system that isolates internal clients from the servers by downloading and storing files on behalf of the clients. it intercepts requests for web-based or other resources that come from

_ is a term used for license like those issues by creative commons license as an alternative to copyright

Answers

, . , .

Explanation:

'

What is computer code?
A. Java Script
B. XML
C. HTML
D. Any programming language

Answers

Answer:

D

Explanation:

Frames control what displays on the Stage, while keyframes help to set up

Answers

Answer: A keyframe is a location on a timeline which marks the beginning or end of a transition. So for example, you have a movie and it transitions to another scene, keyframes tell it when and where to start the transition then when and where to stop the transition.

Write an algorithm that accepts two numbers,
divide the first number by the second and display the
quotient

Answers

Let’s write the algorithm in the form of a pseudocode!

Pseudocode:Quotient_of_Two_Number
Declare: num1, num2, quotient
START
Display (Enter a number)
Read num1
Display (Enter a number)
Read num2
quotient = num1/num2
Print (“Quotient”)
STOP

how to make an app according to peoples will

Answers

Answer:

Follow these steps to create your own app:

1)Choose your app name.

2)Select a color scheme.

3)Customize your app design.

4)Choose the right test device.

5)Install the app on your device.

6)Add the features you want (Key Section)

7)Test, test, and test before the launch.

8)Publish your app.

Explanation:

(!!_!!)

Other Questions
PLEASE HELP IM BEGGING YOU PLEASEEE THABK U SO MUCH E-Eyes has a new issue of preferred stock it calls 20/20 preferred. The stock will pay a $20 dividend per year, but the first dividend will not be paid until 20 years from today. If you require a return of 9.75 percent on this stock, how much should you pay today How many solutions does the system of equations have? Pls help :( A rope is 9 1/2 meters long. How many pieces can be cut from the rope ifeach piece is to be 1/4 meter? Which of the following most likely had the highest unemployment in Oklahoma during the 1980s?bankersoil field workersretail businessesgovernment employees _____ are companies using an adaptive strategy that seeks to minimize risk and maximize profits by following or imitating the proven successes of companies that seek fast growth by searching for new market opportunities, encouraging risk taking, and being the first to bring innovative new products to market. 35 points. Brainliest gets double the points. What is unusual about the conversation in "Sure You Can Ask Me a Personal Question"?A.The reader is expected to join in the conversation.B.The speaker expresses both sides of the conversation.C.The speaker refuses to take a side in the conversation.D.The reader only gets one side of the conversation. A person who uses different programming languages to develop a program is called? The fact that this dialogue contains elements of a Shakespearean sonnet emphasizes Romeos In humans, what provides the first impression of food? Help pleaseeeeeeeeeeeeeeeeeeeeee Which of the following best describes the states rights debate of the early and mid-1800s? Which of the following music sales was not popular in Japan before the term J pop was coined? What is the value of z in the equation 3z+9=z? A rectangle measures 8/3 inches by 9/4 inches. What is its area? A person is born a US citizen if he or she has parents who m to the power of 5 m to the power of 6 n to the power of 11 over m to the power of 3 n to the power of 5 n The difference between 32.6 and a number is 10.2. Which equation can be used to solve this problem?32.6 minus y = 10.2y minus 36.2 = 10.210.2 minus y = 32.6y + 32.6 = 10.2 Please help please explain it step by step please