Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Hi, can i get the same expert who worked on #76907 and #76310 please. mainly because the assignment is related to those two previous assignments.I've attached the assignment PDF and the previous two...

1 answer below »
Hi, can i get the same expert who worked on #76907 and #76310 please. mainly because the assignment is related to those two previous assignments.I've attached the assignment PDF and the previous two assignments in zipped folder in case it makes the assignment easier. i've also attached a screenshot of how the comments need to be added in the new assignment. and i need the new assignment to be saved as Mike_Mawson_Asgn_Three.
i've also attached the textbook as a reference.
and could i get detailed instructions on how to run the program in a seperate word document as well. i'll be using IntelliJ on my end to run it.

Answered 9 days After Mar 19, 2021

Solution

Valupadasu answered on Mar 28 2021
155 Votes
CalculationInterface.java
CalculationInterface.java
**
 * @author Student
 * @version 2.0
 * @since 2021-03-07
 *
public interface CalculationInterface {
    public abstract void calculate();
}
Calculations.java
Calculations.java
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
**
 * @author Student
 * @version 2.0
 * @since 2021-03-07
 *
public class Calculations {
    private Date[] dateA
ay;
    private float[][] dataA
ay;
    public void createDateA
ay(String[][] stockData) {
        try {
            dateA
ay = new Date[stockData.length];
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            for (int idx = 0; idx < stockData.length; idx++) {
                dateA
ay[idx] = format.parse(stockData[idx][0]);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void createDataA
ay(String[][] stockData) {
        dataA
ay = new float[stockData.length][6];
        for (int i = 0; i < stockData.length; i++) {
            for (int j = 1; j < stockData[i].length; j++) {
                dataA
ay[i][j - 1] = Float.parseFloat(stockData[i][j]);
            }
        }
    }
    public Date[] performCalculations() {
        Date[] calDates = new Date[4];
        CalculationInterface calculationsObj = () -> {
            float highestOpen = Integer.MIN_VALUE;
            float highestClose = Integer.MIN_VALUE;
            float lowestOpen = Integer.MAX_VALUE;
            float lowestClose = Integer.MAX_VALUE;
            Date highestOpenDate = new Date();
            Date lowestOpenDate = new Date();
            Date highestCloseDate = new Date();
            Date lowestCloseDate = new Date();
            Map closeValList = new HashMap
();
            for (int i = 0; i < dataA
ay.length; i++) {
                for (int j = 0; j < dataA
ay[i].length; j++) {
                    if (j != 0 && j != 3) {
                        continue;
                    }
                    float tempValue = dataA
ay[i][j];
                    if (j == 0) {
                        if (tempValue > highestOpen) {
                            highestOpen = tempValue;
                            highestOpenDate = dateA
ay[i];
                        }
                        if (tempValue < lowestOpen) {
                            lowestOpen = tempValue;
                            lowestOpenDate = dateA
ay[i];
                        }
                    } else {
                        closeValList.put(i, tempValue);
                        if (tempValue > highestClose) {
                            highestClose = tempValue;
                            highestCloseDate = dateA
ay[i];
                        }
                        if (tempValue < lowestClose) {
                            lowestClose = tempValue;
                            lowestCloseDate = dateA
ay[i];
                        }
                    }
                }
            }
        
            calDates[0] = highestOpenDate;
            calDates[1] = lowestOpenDate;
            calDates[2] = highestCloseDate;
            calDates[3] = lowestCloseDate;
            List list = new LinkedList(closeValList.entrySet());
            Collections.sort(list, new Comparato
Map.Entry() {
                public int compare(Map.Entry o1, Map.Entry o2) {
                    return (o1.getValue()).compareTo(o2.getValue());
                }
            });
            System.out.println();
            System.out.println("Top ten dates with the highest closing value in order of lowest to highest");
            int count = 0;
            for (Map.Entry entry : list) {
                if (count == 10)
                    
eak;
                System.out.printf("%tF %n", dateA
ay[entry.getKey()]);
                count++;
            }
            Collections.sort(list, new Comparato
Map.Entry() {
                public int compare(Map.Entry o1, Map.Entry o2) {
                    return (o2.getValue()).compareTo(o1.getValue());
                }
            });
            count = 0;
            System.out.println();
            System.out.println("Top ten dates with the highest closing value in order of highest to lowest");
            for (Map.Entry entry : list) {
                if (count == 10)
                    
eak;
                System.out.printf("%tF %n", dateA
ay[entry.getKey()]);
                count++;
            }
            System.out.println();
            System.out.println(
                    "Calculating the column difference between open amount and clo...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here