Write a Java program (One class with a main method) to do the following: 1. Ask...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Java program (One class with a main method) to do the following: 1. Ask the user to enter an integer (n) 2. Declare an array of size n with double data type. 3. Ask the user to enter the values of the array. 4. Create another array with of size n with integer data type. 5. Make a copy of the first array to the second array but in reverse order (e.g., the last element in the first array should be store in the first element in the second array and so on). 6. Output values stored in the two arrays. 7. Find and output how many odd values in both arrays are equal based on the index number, i.e. count matching values of two arrays based on same index value AND the element value of the array. Sample Input/output Enter n:4 Enter array values: 1234 First Array:1 234 Second Array:4 3 21 # of Equal values = 0 Enter n:5 Enter array values: 12345 First Array:1 2345 Second Array:5 4 321 # of Equal values = 1 Write a Java program (One class with a main method) to do the following: 1. Ask the user to enter an integer (n) 2. Declare an array of size n with double data type. 3. Ask the user to enter the values of the array. 4. Create another array with of size n with integer data type. 5. Make a copy of the first array to the second array but in reverse order (e.g., the last element in the first array should be store in the first element in the second array and so on). 6. Output values stored in the two arrays. 7. Find and output how many odd values in both arrays are equal based on the index number, i.e. count matching values of two arrays based on same index value AND the element value of the array. Sample Input/output Enter n:4 Enter array values: 1234 First Array:1 234 Second Array:4 3 21 # of Equal values = 0 Enter n:5 Enter array values: 12345 First Array:1 2345 Second Array:5 4 321 # of Equal values = 1
Expert Answer:
Answer rating: 100% (QA)
Certainly Based on the requirements from the image below is a sample Java program that performs the ... View the full answer
Related Book For
College Algebra
ISBN: 978-0134697024
12th edition
Authors: Margaret L. Lial, John Hornsby, David I. Schneider, Callie Daniels
Posted Date:
Students also viewed these programming questions
-
What is the price of the following bond? Face Value: $1,000 YTM (Yield of comparable bonds): 8% Coupon: 8% Maturity: 8 years Round your answer to the nearest two decimals. Do not type the $ symbol.
-
Moran owns a building he bought during year 0 for $237,000. He sold the building in year 6. During the time he held the building, he depreciated it by $33,250. What are the amount and character of...
-
What is the Antebellum Interregional growth hypothesis?
-
Wendall Company specializes in producing fashion outfits. On July 31, 2017, a tornado touched down at its factory and general office. The inventories in the warehouse and the factory were completely...
-
On December 1, 2020, Jurczyk Distributing had the following account balances. During December, the company completed the following summary transactions. Dec. 6 Paid 1,600 for salaries and wages due...
-
Using the Angstrm-Page method, calculate the average horizontal insolation in Hamburg in May and in October with \(\overline{\text { PS }} 40 \%\) and \(60 \%\), respectively.
-
Taxable income and pretax financial income would be identical for Huber Co. except for its treatments of gross profit on installment sales and estimated costs of warranties. The following income...
-
The school district where the Bradleys live needs $1,310,000 from property tax revenues to meet the budget. The total value of assessed property in the district is $120,000,000. What is the tax rate?...
-
(a) Prepare income statements for January and February for Fazli, Gervais, and Consolidation. Break down cost of sales into its three components. (b) Now assume that Fazli uses the equity method to...
-
Describe two workplace procedures for hazard identification in a healthcare settings.
-
(a) Evaluate the characteristic equation of A = 2 3 -(;;) (b) Let A = 204 98 -26 -10 -134 36 14 348 -90 -36 -232 60 28 1716 -472 Find inverse of A vsing determinant (c) Diagonalize A = 5 - 6 hence...
-
(5.3) This exercise deals with deriving the money multiplier - relating high-powered money (the monetary base) to M1 (ignoring traveler's checks). Money demand for M1, Md, can be decomposed into the...
-
Given a list {Subscript[a, 1],Subscript[a, 2],..,Subscript[a, n]}, its harmonic mean is defined as . Now define three functions hmean1, hmean2 and hmean3, all with the input as a given list and...
-
1. Please look for your assigned unknown in the file titled "Unknown - List and Student Assignments". 2. Then, look for the details of the unknown in the file titled Data for Unknown". 3. Put all of...
-
1. Interpret the phylogenetic tree shown below to answer the following questions. Each letter on the cladogram represents an Operational Taxonomic Unit (OTU). a. Draw a star on the node (branch...
-
Berkshire Inc. uses a periodic inventory system. At the end of 2020, it missed counting some inventory items, resulting in an inventory understatement by $620,000. Assume that Berkshire has a 30%...
-
What is the mode?
-
Solve the system in terms of the specified arbitrary variable. 3x - 4y + z = 2 2x + y = 1 (x arbitrary)
-
Find the indicated term or terms of the expansion. Seventh term of (m - 3n) 14
-
Evaluate the expression for p = -4, q = 8, and r = -10. 3 4 00
-
Given the modal mass matrix, \(m_{q}=\left[\begin{array}{ll}2 & 0 \\ 0 & 2\end{array} ight] \mathrm{kg}\), the modal stiffness matrix, \(k_{q}=\left[\begin{array}{cc}5.858 \times 10^{6} & 0 \\ 0 &...
-
For a single-degree-of-freedom spring-mass-damper system subject to forced harmonic vibration, the measured FRF is displayed in Figs. P6.1a and P6.1b. Using the peak picking method, determine \(m\)...
-
The direct and cross FRFs for the two degree of freedom system shown in Fig. P6.2a are provided in Figs. P6.2b and P6.2c. Fig. P6.2 a Two degree of freedom spring-mass-damper system under forced...
Study smarter with the SolutionInn App