I need 2 java programs created using using specifics given. Below
PROGRAM # 1
[login to view URL] a class dataset that stores a number of values of type double. Provides a constructor
Public dataset (int maximumNumberOfValues)
And a write a method
Public void add (double value) that adds a value.
Lastly provide methods to compute the sum, avg, max, and min values
Please feel free to work off of what I started. Thanks
*/
public class DataSet
{
// Implmentation
. . .
/**
Constructs an empty data set.
@param maximumNumberOfValues the maximum this data set can hold
*/
public DataSet(int maximumNumberOfValues)
{
. . .
}
/**
Adds a data value to the data set if there is room in the array.
@param value a data value
*/
public void add(double value)
{
. . .
}
/**
Gets the sum of the added data.
@return sum of the data or 0 if no data has been added
*/
public double getSum()
{
. . .
}
/**
Gets the average of the added data.
@return average of the data or 0 if no data has been added
*/
public double getAverage()
{
. . .
}
/**
Gets the maximum value entered.
@return maximum value of the data
NOTE: returns -Double.MAX_VALUE if no values are entered.
*/
public double getMaximum()
{
. . .
}
/**
Gets the minimum value entered.
@return minimum value of the data
NOTE: returns Double.MAX_VALUE if no values are entered.
*/
public double getMinimum()
{
. . .
}
}
/**
Run some tests for the DataSet class
*/
public class DataSetTester
{
public static void main(String[] args)
{
DataSet data = new DataSet(5);
[login to view URL](3.5);
[login to view URL](7.9);
[login to view URL](15.2);
[login to view URL](-7.3);
[login to view URL]("Sum: " + [login to view URL]());
[login to view URL]("Expected: 19.3");
[login to view URL]("Average: " + [login to view URL]());
[login to view URL]("Expected: 4.825");
[login to view URL]("Maximum: " + [login to view URL]());
[login to view URL]("Expected: 15.2");
[login to view URL]("Minimum: " + [login to view URL]());
[login to view URL]("Expected: -7.3");
}
}
PROGRAM#2
2. A supermarket wants to reward its best customers of each day, showing the customer’s name on a screen in the supermarket. For that purpose the store keeps an Arraylist in the Store class. Please implement the following methods.
Public void addSale(String customerName, double amount )
Public String nameOfBestCustomer ()
To record the sale and returns the name of the customer with the largest sale.
Please use the following information to write a program that prompts the cashier to enter all prices, and names. Adds them to a store object, and displays the best customer’s name.
import java.util.*;
/**
* Code for P7.13
* @author
*/
public class Store
{
public String nameOfBestCustomer(ArrayList<Double> sales,
ArrayList<String> customers)
{
String top = " ";
// Your work starts here
// Your work ends here
return top;
}
public static void main(String[] args)
{
ArrayList<Double> price = new ArrayList<Double>();
ArrayList<String> names = new ArrayList<String>();
Scanner in = new Scanner([login to view URL]);
// Your work starts here
// Your work ends here
Store top = new Store();
[login to view URL]("Best customer's name "
+ [login to view URL](price, names));
}
}
hi i am a java SE ,ee developer this is easy work lets start it. visit my profile and see what other people say about me
Relevant Skills and Experience
java SE, EE
Proposed Milestones
$30 USD - milestone
$15 USD in 1 day
5.0 (20 reviews)
4.7
4.7
4 freelancers are bidding on average $28 USD for this job
hi sir, i will create the java class with the details provided to maintain the list of double values, thanks............................................................
Relevant Skills and Experience
java
Proposed Milestones
$15 USD - completion