Menu

[Solved]Need Help Assignment S Due Tuesday 8 Please Follow Instructions Thoroughly Use Advanced M Q37114825

I need help with this assignment. It’s due Tuesday at 8 AM.Please follow the instructions thoroughly as to not use anyadvanced material we may not have gone over in class. Theinstructions let you know what all should be used. Thanks!

Use only what you have learned in Chapters 1 - 7. Use of advanced material, material not in the text, or project does not fPART 1: Name the class file TopBuyers.java In the main) method, declare and initialize the console and prompt the user for thPART 5 1. Write a method getTopBuyers that takes the buyers array, the sales array, and and the mumber of top users to displa

Use only what you have learned in Chapters 1 – 7. Use of “advanced” material, material not in the text, or project does not follow the instructions, will result in a GRADE OF 0% for the project. Write a java program that produces the following output using methods,_parameters, for loops, if/else, while loops,_doubles, return statements, Scanners,and Arrays “A business owner likes to keep track of her top buyers according to their sales so she may recognize them each month Write a program that will accept a given number of buyers with their sales and then output the number of top buyers requested” Sample Output: jGRASP exec: java TopBuyers How many buyers do you want to enter? 5 Enter the 1st buyer’s last name: Smith Enter the 2st buyer’s last name: Jones Enter the 3st buyer’s last name: Howard Enter the 4st buyer’s last name: Anderson Enter the 5st buyer’s last name: Meyers Enter the 1st buyer’s sales: 48.52 Enter the 2st buyer’s sales: 78.45 Enter the 3st buyer’s sales: 100.00 Enter the 4st buyer’s sales: 25.98 Enter the 5st buyer’s sales: 88.35 How many top buyers should display? 3 The list of sales: 48.52 78.45 100.00 25.98 88.35 The top buyers in order are: Howard Meyers Jones GRASP: operation complete. PART 1: Name the class file TopBuyers.java In the main) method, declare and initialize the console and prompt the user for the number of buyers (see sample output). Store this integer in a variables o We will comple the main method in Part XXX PART 2: 1. Create a new method fillBuyerArray that takes the console and the number of buyers as parameters and returns an array of type String contann the last names of the buyers 2. Create a array for the buyer’s names. The size of the array should use your parameter value do not hardcode! 3. Use a for loop to store the entries from the console into the array (see p. 454). This is similar to your Grades code except you are not summing values – just storing in the array. 4. return the array of buyers names. PART 3: 1. Create a new method fillSalesArray that takes the console and the number of buyers as parameters and returns an array of type double containing the sales of the buyers. 2. Create an array for the buyers sales. The size of the array should use your parameter value – do not hardcode! 3. Use a for loop to store the entries from the console into the array (see p. 454). This is similar to Part 2 4. return the array of buyer’s sales. PART 4 . Back in the main method, call the fillBuyerArray and fillsalesArray methods and store the returning arrays in arrays declared in main (just like we do int value -getValue (console), etc, just with an array.) 2. Prompt the user for how many top buyer’s they would like to display (see Sample Output) .Store the number to display in an int variable. PART 5 1. Write a method getTopBuyers that takes the buyers array, the sales array, and and the mumber of top users to display as parameters and returns an array of type String containing only the top buyers 2. Create an array to hold the top buyers. The size of the array should use your number parameter – do not hardcode. 3. Create a copy of the sales array called tempSales. This will prevent us from deleting items in the original array. Please see: https://www.tutorialspoint.com/java/util/arrays_copyof int.htm for help with this. 4. Inside a for loop: . call the maxIndex method (a “Thelper” method see Part 6) to find the index of the buyer(s) with the highest sales 2. store this buyer in your array of top buyers. 3. So that we don’t keep receiving the same index from out helper method, we must “zero out” the value at each index received in our tempSales array. This is why we made a copy of the array. You can do this by: tempSales [topIndex]-0.0: This will overwrite the data and you will be able to get the “next” top buyer. 5. return the top buyer array PART 6 1. Create a new method maxIndex that takes an array of type double as a parameter (our tempSales) and returns an int containing the index of the top buyer. 2. Use a for loop to compare each element to the next element in the array and store the index of the location of the largest value. See: http: //java.candidjava.com/tutorial/find-the-index-of-the-largest-number-in-an-array.htm for help with this. 3. return this max index. PART 7: . Write method printTopBuyers that takes the buyer’s array and the sales array as parameters. It has not return value. Output the list of all of the sales and then the names of the top buyers. (See Sample Output) PART 8: 1. Call the getTopBuyers method passing the sales, buyers and number of top buyers to display and store the returning array in an array variable (as you did for buyers and sales). 2. Call the printBuyers method passing the array of top buyers and the sales. Show transcribed image text Use only what you have learned in Chapters 1 – 7. Use of “advanced” material, material not in the text, or project does not follow the instructions, will result in a GRADE OF 0% for the project. Write a java program that produces the following output using methods,_parameters, for loops, if/else, while loops,_doubles, return statements, Scanners,and Arrays “A business owner likes to keep track of her top buyers according to their sales so she may recognize them each month Write a program that will accept a given number of buyers with their sales and then output the number of top buyers requested” Sample Output: jGRASP exec: java TopBuyers How many buyers do you want to enter? 5 Enter the 1st buyer’s last name: Smith Enter the 2st buyer’s last name: Jones Enter the 3st buyer’s last name: Howard Enter the 4st buyer’s last name: Anderson Enter the 5st buyer’s last name: Meyers Enter the 1st buyer’s sales: 48.52 Enter the 2st buyer’s sales: 78.45 Enter the 3st buyer’s sales: 100.00 Enter the 4st buyer’s sales: 25.98 Enter the 5st buyer’s sales: 88.35 How many top buyers should display? 3 The list of sales: 48.52 78.45 100.00 25.98 88.35 The top buyers in order are: Howard Meyers Jones GRASP: operation complete.
PART 1: Name the class file TopBuyers.java In the main) method, declare and initialize the console and prompt the user for the number of buyers (see sample output). Store this integer in a variables o We will comple the main method in Part XXX PART 2: 1. Create a new method fillBuyerArray that takes the console and the number of buyers as parameters and returns an array of type String contann the last names of the buyers 2. Create a array for the buyer’s names. The size of the array should use your parameter value do not hardcode! 3. Use a for loop to store the entries from the console into the array (see p. 454). This is similar to your Grades code except you are not summing values – just storing in the array. 4. return the array of buyers names. PART 3: 1. Create a new method fillSalesArray that takes the console and the number of buyers as parameters and returns an array of type double containing the sales of the buyers. 2. Create an array for the buyers sales. The size of the array should use your parameter value – do not hardcode! 3. Use a for loop to store the entries from the console into the array (see p. 454). This is similar to Part 2 4. return the array of buyer’s sales. PART 4 . Back in the main method, call the fillBuyerArray and fillsalesArray methods and store the returning arrays in arrays declared in main (just like we do int value -getValue (console), etc, just with an array.) 2. Prompt the user for how many top buyer’s they would like to display (see Sample Output) .Store the number to display in an int variable.
PART 5 1. Write a method getTopBuyers that takes the buyers array, the sales array, and and the mumber of top users to display as parameters and returns an array of type String containing only the top buyers 2. Create an array to hold the top buyers. The size of the array should use your number parameter – do not hardcode. 3. Create a copy of the sales array called tempSales. This will prevent us from deleting items in the original array. Please see: https://www.tutorialspoint.com/java/util/arrays_copyof int.htm for help with this. 4. Inside a for loop: . call the maxIndex method (a “Thelper” method see Part 6) to find the index of the buyer(s) with the highest sales 2. store this buyer in your array of top buyers. 3. So that we don’t keep receiving the same index from out helper method, we must “zero out” the value at each index received in our tempSales array. This is why we made a copy of the array. You can do this by: tempSales [topIndex]-0.0: This will overwrite the data and you will be able to get the “next” top buyer. 5. return the top buyer array PART 6 1. Create a new method maxIndex that takes an array of type double as a parameter (our tempSales) and returns an int containing the index of the top buyer. 2. Use a for loop to compare each element to the next element in the array and store the index of the location of the largest value. See: http: //java.candidjava.com/tutorial/find-the-index-of-the-largest-number-in-an-array.htm for help with this. 3. return this max index. PART 7: . Write method printTopBuyers that takes the buyer’s array and the sales array as parameters. It has not return value. Output the list of all of the sales and then the names of the top buyers. (See Sample Output) PART 8: 1. Call the getTopBuyers method passing the sales, buyers and number of top buyers to display and store the returning array in an array variable (as you did for buyers and sales). 2. Call the printBuyers method passing the array of top buyers and the sales.

Expert Answer


Answer to I need help with this assignment. It’s due Tuesday at 8 AM. Please follow the instructions thoroughly as to not use any … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *