CSC 210 PROJECT 9 FALL 2020 Project 9 Instructions WHAT TO SUBMIT ● JAVA Files: ○ CONSTANT.java (provided – no need to make change), ○ StandarDevAndHist.java, (30 points) ○ DecAndBin.java (provided –...

1 answer below »


This java project is made up of 4 java files and 2 text files. Only 2 of the 4 java files are incomplete. These 2 java files will need to be completed in order to make the project work. Comments have to be included in what the code is doing.









CSC 210 PROJECT 9 FALL 2020 Project 9 Instructions WHAT TO SUBMIT ● JAVA Files: ○ CONSTANT.java (provided – no need to make change), ○ StandarDevAndHist.java, (30 points) ○ DecAndBin.java (provided – no need to make change), ○ Binary.java (30 points) Please make sure you remove package in your java file! It is required for auto-grading. Decimal And Binary conversion [30 points] Problem Description: 1. Create a class for Binary as used in DecAndBin class. 2. Implement all the below listed concepts in your class. Execution Results (when a “decAndBinTest.txt” file was given as below) C:\Users\ilmiy\.jdks\openjdk-14.0.2\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2\lib\idea_rt.jar=53281:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2\bin" - Dfile.encoding=UTF-8 -classpath C:\Users\ilmiy\IdeaProjects\project5\out\production\project5 DecAndBin Enter n:5 00000000 00000101 Enter binary:111 7 true 00000000 00000001 00000000 00000011 00000000 00000100 00000000 01111111 00000000 10000000 00000000 00000101 7 5 255 25 CSC 210 PROJECT 9 FALL 2020 Contents of “decAndBinTest.txt” 1 1 1 3 1 4 1 127 1 128 1 5 2 111 2 101 2 11111111 2 00011001 You can read about Decimal to Binary conversion and the other way around (Please check the lecture) https://www.electronics-tutorials.ws/binary/bin_2.html https://www.binaryhexconverter.com/decimal-to-binary-converter Standard Deviation and Histogram [30 points] You already know how to calculate sum and mean. You can extend this to the data from a file (data2.txt) Calculate Standard Deviation (check the lecture & https://www.mathsisfun.com/data/standard-deviation- formulas.html ) Here is the execution result using data2.txt Total count is 100 Sum of all the data is 48050 The average of the data is 480.5 The standard deviation of the data is 274.935610643656 1 - 100 :*********** 101 - 200 :****** 201 - 300 :*********** 301 - 400 :***************** 401 - 500 :****** https://www.electronics-tutorials.ws/binary/bin_2.html https://www.binaryhexconverter.com/decimal-to-binary-converter https://www.mathsisfun.com/data/standard-deviation-formulas.html https://www.mathsisfun.com/data/standard-deviation-formulas.html CSC 210 PROJECT 9 FALL 2020 501 - 600 :************* 601 - 700 :********* 701 - 800 :********** 801 - 900 :*********** 901 - 1000 :****** Project 9 Instructions ○ StandarDevAndHist.java, (30 points) Decimal And Binary conversion [30 points] 1. Create a class for Binary as used in DecAndBin class. Standard Deviation and Histogram [30 points]
Answered Same DayDec 14, 2021CSC 210

Answer To: CSC 210 PROJECT 9 FALL 2020 Project 9 Instructions WHAT TO SUBMIT ● JAVA Files: ○ CONSTANT.java...

Valupadasu answered on Dec 14 2021
148 Votes
Binary.java
Binary.java
public class Binary {
    int dec;
    int[] bin;
    public Binary() {
        dec = 0;
     bin = new int[CONSTANT.BIT_SIZE];
    }
    public Binary(int dec) {
        this.dec = dec;
        bin = convertDecToBin(dec);
    }
    // Fill in the contructor below
    // Make sure that dec value to be properly calculated
    public Binary(int[] bin) {
        this.bin = bin;
        dec = convertDecToBin(bin);
    }
    // Fill in the contructor below
    // Make sure that dec value to be properly calculated
    public Binary(String binS) {
        int binArr[] = new int[binS.length()];

        for(int i=0; i < binS.length() ; i++) {
            binArr[i] = binS.charAt(i);
        }
        dec = convertDecToBin(binArr);
    }
    public int getDec() {
        return dec;
    }
    // convert the bin array to decimal value
    private int convertDecToBin(int[] bin) {
        int digit, power, sum = 0;
        for (int i = bin.length -1, j = 0 ; i >= 0 && j < bin.length; i--, j++) {
            digit = bin[i] - 48; // converting char to equivalent int
            power = (int) Math.pow(2, j);
            sum = sum + (digit * power);
   ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here