Follow the instructions and do a complete Java code with no errors. And give explanation. Introduction and
Fantastic news! We've Found the answer you've been seeking!
Question:
Follow the instructions and do a complete Java code with no errors. And give explanation.
Transcribed Image Text:
Introduction and Background As we discussed in lecture, arrays can be very useful data structures. We already discussed how to load items into an array and how to search an array for an item. In this lab you will implement a number of other useful operations that can be done on arrays. You will then write a simple main program to utilize your methods. For help with this lab, see course notes for Lecture 11 and handouts ex11.java and ex12a.java Lab Exercise You are to write the following 4 methods: public static double [] getData (Scanner input) // Create an array from user input // then return the new array. The user will input the size of the array // and the data that will go into the array. Note the return type. public static double max (double [] data) public static double sum (double [] data) public static double ave (double [] data) // return the maximum value in the // array. // sum the items in the array // and return the result // call sum to get the sum // and then return the average Once you have completed the methods above, write a simple main program that does the following: 1) Calls the getData() method to generate, input and return a new array (note parameter and return value) 2) Calls the max, sum and ave methods to get those values and prints them all out in a nicely formatted way Grading and Submission Once you have your program working, notify your TA so you can demonstrate it to them: Run your program for your TA, demonstrating that all of your methods work properly. Also, briefly show your code to your TA so they can verify that you used methods for your implementation. There will be 4 raw points for this lab, broken down in the following way. Introduction and Background As we discussed in lecture, arrays can be very useful data structures. We already discussed how to load items into an array and how to search an array for an item. In this lab you will implement a number of other useful operations that can be done on arrays. You will then write a simple main program to utilize your methods. For help with this lab, see course notes for Lecture 11 and handouts ex11.java and ex12a.java Lab Exercise You are to write the following 4 methods: public static double [] getData (Scanner input) // Create an array from user input // then return the new array. The user will input the size of the array // and the data that will go into the array. Note the return type. public static double max (double [] data) public static double sum (double [] data) public static double ave (double [] data) // return the maximum value in the // array. // sum the items in the array // and return the result // call sum to get the sum // and then return the average Once you have completed the methods above, write a simple main program that does the following: 1) Calls the getData() method to generate, input and return a new array (note parameter and return value) 2) Calls the max, sum and ave methods to get those values and prints them all out in a nicely formatted way Grading and Submission Once you have your program working, notify your TA so you can demonstrate it to them: Run your program for your TA, demonstrating that all of your methods work properly. Also, briefly show your code to your TA so they can verify that you used methods for your implementation. There will be 4 raw points for this lab, broken down in the following way.
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
What is the difference between MouseListener and MouseAdapter? [3 marks] (b) Via suitable HTML, the compiled version of the following Java code is presented to the appletviewer application: import...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
A company is implementing Dynamics 365 Supply Chain Management. The company plans to implement the solution in a phased approach across several incremental projects. The project manager needs a...
-
1. How does Accenture target to its B-to-B audience so effectively? 2. Evaluate Accenture's history of branding campaigns. What remains consistent throughout?
-
To counter the slowing rate of economic growth, liberal economists would recommend a. Taxation and spending policies that decrease aggregate demand. b. Taxation and spending policies that increase...
-
What is an Actor and what is its relationship to a UC?
-
You have just been hired as a loan officer at Slippery Rock State Bank. Your supervisor has given you a file containing a request from Lydex Company, a manufacturer of safety helmets. For a...
-
Based on the following data, how much of a refund would Rip and Beth receive after filing their income tax return? ( Input the amount as a positive value. Round your intermediate calculations and...
-
A company has developed a new product. It needs to decide whether or not to product test and market test before launch, and has been advised that, even though these processes do cost money, they...
-
Better-Life Massage Clinic (BM) provides various types ofmassage service at the price of $32. Currently, BM opens 30 daysper month and serves 30 customers a day. BM pays its own masseusesthe wage of...
-
The House of Commons Committee of Public Accounts produced a report on the budget for the London 2012 Olympic and Paralympic Games, to investigate the reasons for budget increases announced by the...
-
(a) Using the information provided in question C12.1, prepare a spreadsheet containing a trial balance, adjustment and resulting figures for income statement (profit and loss account) and statement...
-
In the following extract, the College of Charleston, USA, describes on its website how it estimates the standard cost of attendance in respect of a student. To consider a student for federal...
-
Prepare ledger accounts to report the transactions and events of questions C8.1 and C8.2. Data from C8.1 The Biscuit Manufacturing Company commenced business on 1 January Year 1 with capital of...
-
Operating cash flow was 43.0 million (2008: 30 million), representing 93% of adjusted operating profit, despite an increase in stock and debtors commensurate with the growth of the business. Net debt...
-
6. Carsen Company manufactures two products Atlas and Bertha that sell for $120 and $80 respectively. Each product uses only one type of raw material that costs $6 per pound. The company has the...
-
Before the latest financial crisis and recession, when was the largest recession of the past 50 years, and what was the cumulative loss in output over the course of the slowdown?
-
Charlie's Green Lawn Care is a cash basis taxpayer. Charlie Adame, the sole proprietor, is considering delaying some of his December 2012 customer billings for lawn care into the next year. In...
-
Mike sells his home to Jane on April 2, 2012. Jane pays the property taxes covering the full calendar year in October, which amount to $2,500. How much may Mike and Jane each deduct for property...
-
William sold Section 1245 property for $25,000 in 2012. The property cost $35,000 when it was purchased 5 years ago. The depreciation claimed on the property was $16,000. a. Calculate the adjusted...
-
Speeds of bullet trains. Determine whether the data are qualitative or quantitative. Explain your reasoning.
-
American Standard Code for Information Interchange (ASCII) codes. Determine whether the data are qualitative or quantitative. Explain your reasoning.
-
Colors of fabrics at a clothing store. Determine whether the data are qualitative or quantitative. Explain your reasoning.
Study smarter with the SolutionInn App