Question: using java...there seems to be a few errors. feel free to rewrite it and fix or change it all up!! Class One! public class

 using  java...there seems to be a few errors. feel free to rewrite it and fix or change it all up!!

 

Class One!

public class App {
    //data fields
    private String name; //to hold the name
    private int[] academicData; //to hold the grades from 6 core CS courses
    //constructors
    public Applicants(){
        //default constructor
    }
    public Applicants(String name, int[] academicData){
        setName(name);
        setAcademicData(academicData);
    }
    public Applicants(String name){
        setName(name);
    }
    //getters and setters
    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name = name;
    }
    public int[] getAcademicData(){
        return academicData;
    }
    public void setAcademicData(int[] academicData){
        this.academicData = academicData;
    }
    //methods to analyze applications
    public boolean averageAbove85(){
        int sum = 0;
        for (int grade : academicData){
            sum += grade;
        }
        double average = sum / academicData.length;
        return average > 85;
    }
    public boolean noGradeBelow65(){
        for (int grade : academicData){
            if (grade                 return false;
            }
        }
        return true;
    }
    public boolean atleastFour85(){
        int count = 0;
        for (int grade : academicData){
            if (grade > 85){
                count++;
            }
        }
        return count >= 4;
    }
    public boolean upperLevelAbove85(){
        int sum = 0;
        for (int i = academicData.length - 4; i             sum += academicData[i];
        }
        double average = sum / 4;
        return average > 85;
    }
    public boolean customFilter(int[] data){
        int sum = 0;
        int count = 0;
        for (int i = 0; i             if (i                 sum += data[i];
            }
            else if (i >=6 && data[i] > 3.5){
                count++;
            }
        }
        double average = sum / 6;
        return (average > 70 && count > 0);
    }
}

 

Class Two!! 

 

public class TestApp {
    public static void main(String[] args){
        Applicants applicant1 = new Applicants("John Doe", new int[]{90, 95, 80, 100, 75, 95});
        System.out.println(applicant1.averageAbove85()); //true
        System.out.println(applicant1.noGradeBelow65()); //true
        System.out.println(applicant1.atleastFour85()); //false
        System.out.println(applicant1.upperLevelAbove85()); //true
        System.out.println(applicant1.customFilter(new int[]{90, 95, 80, 100, 75, 95, 4.0, true, 3})); //true
        Applicants applicant2 = new Applicants("Jane Doe", new int[]{60, 70, 80, 85, 95, 100});
        System.out.println(applicant2.averageAbove85()); //true
        System.out.println(applicant2.noGradeBelow65()); //fals
        System.out.println(applicant2.atleastFour85()); //true
        System.out.println(applicant2.upperLevelAbove85()); //true
        System.out.println(applicant2.customFilter(new int[]{60, 70, 80, 85, 95, 100, 3.2, false, 1})); //false
    }
}

incompatible types: possible lossy conversion from double to int :8 incompatible types: boolean cannot be averageAbove85 noGradeBelow65 . atLeastFour85 accepts applicants that have an average above 85 accepts 

incompatible types: possible lossy conversion from double to int :8 incompatible types: boolean cannot be converted to int :8 incompatible types: possible lossy conversion from double to int:15 incompatible types: boolean cannot be converted to int:15

Step by Step Solution

3.43 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Ive reviewed your code and found several issues that need to be addressed Ill provide you with a corrected version of your code along with explanation... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!