Write a program to ask the user enter a list and then display this list. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program to ask the user enter a list and then display this list. The user should specify the length of the list and the data type of the elements of the list. The program should work exactly as in the following examples. The text in bold indicates the user input. Example 1. Enter the length of the list: 4 Choose the type of data (integer (I) string (S) / decimal (D)): I Enter the list element: 10 Enter the list element: 20 Enter the list element: 5 Enter the list element: 10 You have entered an integer list: 10, 20, 5, 10 Example 2. Enter the length of the list: 2 Choose the type of data (integer (I) string (S) decimal (D)): S Enter the list element: hi there Enter the list element: uow You have entered a string list: "hi there", "uow" Example 3. Enter the length of the list: 1 Choose the type of data (integer (I) string (S) decimal (D)): D Enter the list element: 1.7 You have entered a decimal list: 1.7 Write a program to ask the user enter a list and then display this list. The user should specify the length of the list and the data type of the elements of the list. The program should work exactly as in the following examples. The text in bold indicates the user input. Example 1. Enter the length of the list: 4 Choose the type of data (integer (I) string (S) / decimal (D)): I Enter the list element: 10 Enter the list element: 20 Enter the list element: 5 Enter the list element: 10 You have entered an integer list: 10, 20, 5, 10 Example 2. Enter the length of the list: 2 Choose the type of data (integer (I) string (S) decimal (D)): S Enter the list element: hi there Enter the list element: uow You have entered a string list: "hi there", "uow" Example 3. Enter the length of the list: 1 Choose the type of data (integer (I) string (S) decimal (D)): D Enter the list element: 1.7 You have entered a decimal list: 1.7
Expert Answer:
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
What is a branch delay slot and why does it arise? [7 marks] How can branch delays be avoided? If a processor exhibited one branch delay slot how would you reorder (and possibly modify) the...
-
Use the Chain Rule to calculate d/dt (r(t)) at the value of t given. f(x, y) = x = xy, r(t) = (R R - 41), t = 4
-
Lakeland Corporation manufactures and sells a single product. In preparing the budget for the first quarter, the company's cost accountant has assembled the following information: The company uses...
-
Gonzalez Company has a balance in its Accounts Payable control account of $8,250 on January 1, 2022. The subsidiary ledger contains three accounts: Rye Company, balance $3,000; Keyes Company, balance...
-
What is the default filename that make will process if no other is given?
-
Prepare a Statement of Activities for Tazewell County for calendar year 20X9, given the following: General property tax revenues . . . . . . . . . . . . . . . . . . . . . . . . . . . $70,000,000...
-
1. A thin film is laid over a glass pane as shown. White light is incident on the film, coming straight in. At a point where the light is incident on the film, it appears green ( = 525 nm). Find (a)...
-
Procter and Gamble (P&G) Ltd has won the government tender to develop and deliver a wearable health monitoring watch to the Medic Aid program. As part of the acceptance criteria, the device must...
-
Despite the increasing availability and variety of project management (PM) tools in recent years, projects continue to face challenges. PM tools are used to design and control project plans,...
-
Zara is one of Inditex's biggest brands. Source: Vytautas Kielaitis/Shutterstock Amancio Ortega is the biggest shareholder in Inditex, a Spanish company he started more than forty years ago, which...
-
Discuss most pressing issues in internal and external auditing using internal and external context templates in Philippine setting? Discuss by using causal-layered analysis using iceberg model
-
"According to Investopedia (2014), inventory management is defined as the controlling of the ordering, storage and use of stock or components in the production of products in order to create finished...
-
Based on your analysis, make a recommendation to the owner to either add or not add the low-cost lunch special. Explain your rationale based on the numbers and desired after-tax profit. Use everyday...
-
Write a Python function, add_digits, that sums the digits of a 3-digit integer number. Function add_digits should have one parameter, n, a positive integer with 3 digits, and return the sum of the...
-
Refer to the situation described inBE 18-13, but assume a 2-for-1 stock split instead of the 5% stock dividend. Prepare the journal entry to record the stock split if it is to be effected in the form...
-
? can be computed using the following series: Write a method that returns?m(i)?for a given?i?and write a test program that displays the following table:i .......................m(i)1...
-
Rewrite Programming Exercise 5.39 as follows: ? Use a for loop instead of a do-while loop. ? Let the user enter COMMISSION_SOUGHT instead of fixing it as a constant. You have just started a sales job...
-
Write a program that prompts the user to enter a string and displays its length and its first character.
-
In a hypothesis test the p value is 0.043. This means that we can find statistical significance at: (1) both the 0.05 and 0.01 levels (2) the 0.05 but not at the 0.01 level (3) the 0.01 but not at...
-
In testing the null hypothesis that p = 0:3 against the alternative that p 0:3, the probability of a type II error is ______ when the true p = 0:4 than when p = 0:6. (1) the same (2) smaller (3)...
-
An article states there is no significant evidence that median income increased. The implied null hypothesis is: (1) Median income increased. (2) Median income changed. (3) Median income did not...
Study smarter with the SolutionInn App