Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

having trouble with part 4. please write in java with comments Problem 1: Ask for keyboard input of a decimal number. Use a loop to

having trouble with part 4. please write in java with comments

Problem 1: Ask for keyboard input of a decimal number. Use a loop to keep asking for input of up to ten numbers. Exit the loop if ten numbers are entered or if a sentinel value for QUIT is entered. Store the numbers in an array. Sort the array according to ascending number. Get the average for all the numbers in the array. Print out the average. Calculate the distance from the average for each number in the array and print out the difference. Use a binary search method to search for a number in the array and display to the console. Problem

2: Create a phone book where you can enter names and corresponding phone numbers. Store the data in two parallel arrays. Create a lookup method that asks the user to input a name. Look up a name and then retrieve the associated phone number. Problem

3: Create a Recording class that stores the name of an artist, song, and play time. Create appropriate methods to set and get the data. Create a main program to enter the data for a recording and store each set of data in a Recording object. Store Recording objects with a Recording array. Prompt the user for how to sort the objects - by either artist, song or play time. Create three static methods that are called depending on the selection to sort by the appropriate field.

4)For the array in problem 1, create an ArrayMethods class where you will add static methods to manipulate your array. Add a method called getMin() that returns the lowest value in the array or -1 if the array is empty, and another method called removeMin() so that the item with the lowest value is not only returned by the method, but also removed from the array. Add some code in main() to test these two methods. You can assume that all the values entered are positive numbers.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions