Knowee
Questions
Features
Study Tools

Write a Java program that has three interfaces1. Academic Fees with a method calcAA() which takes the number of course as input parameter to calculate the academic fees by assigning Rs.500/- per course.2. Hostel Fees with a method calcHF() which takes the number of days as input parameter to calculate the hostel fees by assigning Rs.50/- per day.3. Extracurricular Fees with a method calcECF() which takes the number of extra-curricular course as input parameter to calculate the extra-curricular fees by assigning Rs.600/- per extra-curricular course.Create classes and objects using interface to calculate the total fees for1. A general day scholar student involved in no extracurricular courses2. A general hosteller student involved in no extracurricular courses3.  A   scholar student involved in extracurricular courses4. A hosteler student involved in extracurricular courses

Question

Write a Java program that has three interfaces1. Academic Fees with a method calcAA() which takes the number of course as input parameter to calculate the academic fees by assigning Rs.500/- per course.2. Hostel Fees with a method calcHF() which takes the number of days as input parameter to calculate the hostel fees by assigning Rs.50/- per day.3. Extracurricular Fees with a method calcECF() which takes the number of extra-curricular course as input parameter to calculate the extra-curricular fees by assigning Rs.600/- per extra-curricular course.Create classes and objects using interface to calculate the total fees for1. A general day scholar student involved in no extracurricular courses2. A general hosteller student involved in no extracurricular courses3.  A   scholar student involved in extracurricular courses4. A hosteler student involved in extracurricular courses

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution 1

Here is a Java program that implements the given problem:

interface AcademicFees {
    int calcAF(int courses);
}

interface HostelFees {
    int calcHF(int days);
}

interface ExtracurricularFees {
    int calcECF(int courses);
}

class DayScholar implements AcademicFees {
    public int calcAF(int courses) {
        return courses * 500;
    }
}

class Hosteller implements AcademicFees, HostelFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcHF(int days) {
        return days * 50;
    }
}

class Scholar implements AcademicFees, ExtracurricularFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcECF(int courses) {
        return courses * 600;
    }
}

class HostellerScholar implements AcademicFees, HostelFees, ExtracurricularFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcHF(int days) {
        return days * 50;
    }

    public int calcECF(int courses) {
        return courses * 600;
    }
}

public class Main {
    public static void main(String[] args) {
        DayScholar ds = new DayScholar();
        System.out.println("Total fees for a general day scholar student: " + ds.calcAF(5));

        Hosteller h = new Hosteller();
        System.out.println("Total fees for a general hosteller student: " + (h.calcAF(5) + h.calcHF(30)));

        Scholar s = new Scholar();
        System.out.println("Total fees for a scholar student: " + (s.calcAF(5) + s.calcECF(2)));

        HostellerScholar hs = new HostellerScholar();
        System.out.println("Total fees for a hosteller scholar student: " + (hs.calcAF(5) + hs.calcHF(30) + hs.calcECF(2)));
    }
}

This program creates interfaces for AcademicFees, HostelFees, and ExtracurricularFees, each with their respective methods to calculate fees. It then creates classes for DayScholar, Hosteller, Scholar, and HostellerScholar, each implementing the necessary interfaces. The main method then creates an object of each class, calculates the total fees for each type of student, and prints the result.

This problem has been solved

Solution 2

Here is the Java program that implements the given problem:

interface AcademicFees {
    int calcAF(int courses);
}

interface HostelFees {
    int calcHF(int days);
}

interface ExtracurricularFees {
    int calcECF(int courses);
}

class DayScholar implements AcademicFees {
    public int calcAF(int courses) {
        return courses * 500;
    }
}

class Hosteller implements AcademicFees, HostelFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcHF(int days) {
        return days * 50;
    }
}

class Scholar implements AcademicFees, ExtracurricularFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcECF(int courses) {
        return courses * 600;
    }
}

class HostellerScholar implements AcademicFees, HostelFees, ExtracurricularFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcHF(int days) {
        return days * 50;
    }

    public int calcECF(int courses) {
        return courses * 600;
    }
}

public class Main {
    public static void main(String[] args) {
        DayScholar ds = new DayScholar();
        System.out.println("Total fees for a general day scholar student: " + ds.calcAF(5));

        Hosteller h = new Hosteller();
        System.out.println("Total fees for a general hosteller student: " + (h.calcAF(5) + h.calcHF(30)));

        Scholar s = new Scholar();
        System.out.println("Total fees for a scholar student: " + (s.calcAF(5) + s.calcECF(2)));

        HostellerScholar hs = new HostellerScholar();
        System.out.println("Total fees for a hosteller scholar student: " + (hs.calcAF(5) + hs.calcHF(30) + hs.calcECF(2)));
    }
}

This program creates interfaces for AcademicFees, HostelFees, and ExtracurricularFees, each with their respective methods to calculate fees. Then, it creates classes for DayScholar, Hosteller, Scholar, and HostellerScholar, each implementing the necessary interfaces. In the main method, it creates an object of each class, calculates the total fees for each type of student, and prints the result.

This problem has been solved

Solution 3

Here is the Java program that implements the given problem:

interface AcademicFees {
    int calcAF(int courses);
}

interface HostelFees {
    int calcHF(int days);
}

interface ExtracurricularFees {
    int calcECF(int courses);
}

class DayScholar implements AcademicFees {
    public int calcAF(int courses) {
        return courses * 500;
    }
}

class Hosteller implements AcademicFees, HostelFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcHF(int days) {
        return days * 50;
    }
}

class Scholar implements AcademicFees, ExtracurricularFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcECF(int courses) {
        return courses * 600;
    }
}

class HostellerWithEC implements AcademicFees, HostelFees, ExtracurricularFees {
    public int calcAF(int courses) {
        return courses * 500;
    }

    public int calcHF(int days) {
        return days * 50;
    }

    public int calcECF(int courses) {
        return courses * 600;
    }
}

public class Main {
    public static void main(String[] args) {
        DayScholar ds = new DayScholar();
        System.out.println("Total fees for a general day scholar student: " + ds.calcAF(5));

        Hosteller h = new Hosteller();
        System.out.println("Total fees for a general hosteller student: " + (h.calcAF(5) + h.calcHF(30)));

        Scholar s = new Scholar();
        System.out.println("Total fees for a scholar student: " + (s.calcAF(5) + s.calcECF(2)));

        HostellerWithEC hec = new HostellerWithEC();
        System.out.println("Total fees for a hosteller student with extracurricular courses: " + (hec.calcAF(5) + hec.calcHF(30) + hec.calcECF(2)));
    }
}

This program creates interfaces for AcademicFees, HostelFees, and ExtracurricularFees, each with their respective methods to calculate fees. Then, it creates classes for DayScholar, Hosteller, Scholar, and HostellerWithEC, each implementing the necessary interfaces. In the main method, it creates an object of each class and calculates the total fees for each type of student.

This problem has been solved

Similar Questions

Scholarship Scheme Calculation ProgramYou are tasked with developing a scholarship scheme calculation program for a university. The program will determine the amount of fees to be waived for students based on their academic excellence and sports achievements. Requirements:Student Class Hierarchy: Create an abstract class Student with the following attributes:regNo (Registration Number)name (Name of the student)FEES (Static constant representing the total fees, which is set to 2,00,000)Implement an abstract method calculateFees() in the Student class.Implement two subclasses of Student:AcademicExcellence: Contains attributes:CGPA (Grade Point Average)AI (Annual Income)Sports: Contains attributes:sportLevel (Level of sports achievement: State, National, International)noOfGamesPlayed (Number of games played by the student)Scholarship Criteria: For AcademicExcellence:If CGPA is 'S' and AI is less than 30,000, the entire fees will be waived.If CGPA is 'A' and AI is between 31,000 to 1 lakh, 50% of the fees will be waived.Otherwise, no fees will be waived.For Sports:If the student is an international player and has played more than 2 games, the entire fees will be waived.If the student is a national player and has played more than 10 games, 50% of the fees will be waived.If the student is a state player and has played between 20 to 30 games, 25% of the fees will be waived.Otherwise, no fees will be waived.Input/Output Format: Prompt the user to input the number of students.For each student, ask whether they are applying based on academic excellence or sports.Depending on the choice:For AcademicExcellence: Ask for regNo, name, CGPA, and AI.For Sports: Ask for regNo, name, sportLevel, and noOfGamesPlayed.Calculate and display the fees to be paid by each student based on the scholarship criteria.

Develop the Internal mark calculation system based on the attendance percentage using Java. Get the student name, register number, total number of working days in the semester and Number of days present. Calculate attendance percentage of the students and award attendance mark based on the following condition. Attendance percentage >=90 – 5 MarksAttendance percentage >=80 and < 90 – 4 MarksAttendance percentage >=75 and < 80 – 3 MarksAttendance percentage < 75  - 0 MarksImplement using inheritance

You have been assigned to develop a Course Enrollment and Grade Management System in Java for a university. The system should provide functionality to enroll students in courses, assign grades to students, and calculate overall course grades for each student. The project should demonstrate the effective utilization of static methods and variables to keep track of enrollment and grade-related information across multiple instances of the Student and Course classes. It should also showcase your ability to manipulate object state and define behavior through instance methods.Requirements:Student Class:The Student class should have private instance variables to store student information such as name, ID, and enrolled courses.Implement appropriate access modifiers and provide public getter and setter methods for accessing and updating student information.Design a method to enroll students in courses. It should accept a Course object as a parameter and add the course to the student's enrolled courses.Implement a method to assign grades to students. It should accept a Course object and a grade for the student and update the student's grade for that course. Course Class:The Course class should have private instance variables to store course information such as course code, name, and maximum capacity.Use appropriate access modifiers and provide public getter methods for accessing course information.Implement a static variable to keep track of the total number of enrolled students across all instances of the Course class.Design a static method to retrieve the total number of enrolled students.CourseManagement Class:The CourseManagement class should have private static variables to store a list of courses and the overall course grades for each student.Use appropriate access modifiers to control access to the variables.Implement static methods to add new courses, enroll students, assign grades, and calculate overall course grades for each student.The addCourse method should accept parameters for course information and create a new Course object. It should add the course to the list of courses.The enrollStudent method should accept a Student object and a Course object. It should enroll the student in the course by calling the appropriate method in the Student class.The assignGrade method should accept a Student object, a Course object, and a grade. It should assign the grade to the student for that course by calling the appropriate method in the Student class.The calculateOverallGrade method should accept a Student object and calculate the overall course grade for that student based on the grades assigned to them.Administrator Interface:Develop an interactive command-line interface for administrators to interact with the Course Enrollment and Grade Management System.Display a menu with options to add a new course, enroll students, assign grades, and calculate overall course grades.Prompt the administrator for necessary inputs and call the appropriate methods in the CourseManagement and Student classes to perform the requested operations.Implement error handling to handle cases where invalid inputs are provided or when enrolling students in courses that have reached their maximum capacity.Documentation:Provide comprehensive documentation for the project, explaining the purpose and usage of each class, method, and variable.Describe how static methods and variables are utilized to track enrollment and grade-related information across multiple instances of the Student and Course classes.Include instructions for running the program and interacting with the administrator interface.

Design a Java program to process loan applications for customers. Each loan application includes details such as the applicant's name, salary, and loan amount. The program evaluates each loan application based on certain criteria. If the applicant's salary is greater than $50,000 and the requested loan amount is within twice the applicant's salary, the loan application is approved; otherwise, it is rejected. Implement the program using classes and objects. Write a Java code that performs the following tasks: Define a class LoanApplication with private fields for the applicant's name, salary, loan amount, and loan approval status.Implement a constructor to initialize the loan application details.Create a method processLoan() to evaluate the loan application based on the specified criteria.Define a class Loan with a main method to interact with the user.Prompt the user to input details for multiple loan applications.Process each loan application and display whether it is approved or rejected.Additionally, display the names, salaries, and loan amounts of customers whose loan applications are approved.Demonstrate the functionality of your program with a sample input/output scenario.

The theatre wants to collect the names of all audience who visit the theatre and calculate the total amount collected as fare for the tickets from the audience. Write a Java program

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.