So i am new to java programming and struggling with interfaces, abstract class, set and get methods. i know these are the basics of OOP.
CAN someone please help me with the following part of my problem:
in iterface EssentialLivingCosts what should i include more so that i can access it from the class OncampusStudents
fullproblem:
Write a program that computes the cost of yearly expenses of a university student using Object Oriented Programming. Code using the conditions below.
1. Make an Abstract UniversityStudent Class to code the conditions below. You must use constructor, setters and getters and make the fields private.
For all students: name and year (freshman, sophomore, junior, senior) (These are all fields except year which is an ArrayList) number of courses for the year (Assuming each course is 3 credits) (This is a field and Assign a constant fee value of 1000.30$/course)
2. Make an Interface with name EssentialLivingCost which has the 3 methods to calculate: costs of food, textbooks and misc. (clothing, entertainment etc.). (This is an abstract methods)
3. Make 2 concrete classes known as OnCampusStudent and OffCampusStudent. These classes extend the UniversityStudent Class and Implement the EssentialLivingCost Interface. Code the respective methods accordingly and for OnCampusStudent assign cost of housing for a year to be 12000$/year. For OffCampusStudent, ask his place of dwelling. If Surrey, the cost of housing is 7200$/year and if Burnaby it is 13200$/year.
4. Now code the Main Class, ask here the name of the student, his year of study, cost of food, textbooks and misc, his place of living, number of courses in the year. Use instantiated objects from the 2 concrete classes to find the total cost of the student for the year. Print the Student’s name, his year at the school and his total estimated yearly cost.
What I have tried:
public interface EssentialLivingCost {
public abstract double food();
public abstract double books();
public abstract double clothes();
public abstract double transport();
public abstract double misc();
}