Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

in java language Question 2 : Design a programming named CharDistribution.java,

ID: 3850855 • Letter: I

Question

in java language

Question 2 : Design a programming named CharDistribution.java, which counts how many times each of the alphabetic characters appears in the

data file (char.txt). Then print the result as a histogram as specified as follows:

NOTE: You MUST accept the file name from command argument list: Scanner input=new Scanner(new File(args[0]));

Otherwise, you will get zero for this question.

char.txt

The 22-member Greater Richmond Solar Co-op today issued a request for proposals (RFP) from area solar installers. The group members

created the co-op to save money and make going solar easier, while building a network of solar supporters. Drive Electric RVA, the Richmond Temple,

RVA HUB and VA SUN are the co-op sponsors.

Local installers interested in serving the group can download the RFP here and response template here. Richmond-area residents interested

in joining the co-op can sign up at www.vasun.org/richmond.

Joining the co-op is not a commitment to purchase panels. Co-op members will select a single company to complete all of the installations.

They will then have the option to purchase panels individually based on the installer?s group rate. By going solar as a group and choosing a single installer,

participants can save up to 20% off the cost of their system.

Explanation / Answer

/**
*
* @author Sam
*/
public abstract class Shape {
    String name;
    public abstract double perimeter();
    public abstract double area();
}

class RightTriangle extends Shape {
    private double a;
    private double b;
    private double c; //hypotenuse

    public double getA() {
        return a;
    }

    public void setA(double a) {
        if (a*a + b*b == c*c && a >= 1.0 && a <=100)
            this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        if (a*a + b*b == c*c && b >= 1.0 && b <=100)
            this.b = b;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        if (a*a + b*b == c*c && c >= 1.0 && c <=100)
            this.c = c;
    }

    public String getName() {
        return name;
    }

    @Override
    public double perimeter() {
        return a+b+c;
    }

    @Override
    public double area() {
        return 0.5 * a * b;
    }

    public RightTriangle(double a, double b, double c) {
        name = "RightTriangle";
        if (a*a + b*b == c*c && a >= 1.0 && a <=100 && b >= 1.0 && b <=100 && c >= 1.0 && c <=100) {
            this.a = a;
            this.b = b;
            this.c = c;
        }
        else {
            this.a = 3;
            this.b = 4;
            this.c = 5;
        }
    }

    @Override
    public String toString() {
        return "RightTriangle[" + "a=" + a + ", b=" + b + ", c=" + c + ", perimeter= " + perimeter() + ", area=" + area() + ']';
    }
  
}

class Square extends Shape {
    private double a;

    public double getA() {
        return a;
    }

    public void setA(double a) {
        if (a >= 1 && a <= 100)
            this.a = a;
        else
            a = 10;
    }
  
    @Override
    public double perimeter() {
        return 4 * a;
    }

    @Override
    public double area() {
        return a * a;
    }

    public Square(double a) {
        if (a >= 1 && a <= 100)
            this.a = a;
        else
            a = 10;
    }

    @Override
    public String toString() {
        return "Square[" + "a=" + a + ", perimeter=" + perimeter() + ", area=" + area() + ']';
    }
  
}

class TestShape {
    public static void main(String[] args) {
        RightTriangle triangle = new RightTriangle(3, 4, 5);
        System.out.println(triangle);
        Square square = new Square(10);
        System.out.println(square);
    }
}

Here you go champ. Answer to Q1 is given. I cannot provide you with answer to Quston 2.because chegg doesnot allow answering more than 1 questins in a single answer. I have not commented since I kept the code as simple and short as possile