User Story
User Story: As a frequent traveler, I want to be able to track my expenses easily so that I can effectively manage my budget and analyze my spending habits.
Acceptance Criteria:
- The application should allow me to create expense categories such as accommodation, transportation, meals, and entertainment.
- I should be able to add new expenses, specifying the category, date, amount, and description.
- The application should provide a summary of my total expenses and display them in a visually appealing manner, such as graphs or charts.
- I should be able to filter and search for expenses based on categories, dates, or descriptions.
- The application should allow me to export my expense data in a format compatible with spreadsheet software for further analysis.
- I should be able to set a budget for each expense category and receive notifications when I exceed a certain threshold.
- The application should provide a secure login system to protect my expense data.
- It should be accessible and responsive, allowing me to use it on both desktop and mobile devices.
Solution
Abstract Class:
public abstract class Shape {
public abstract Decimal calculateArea();
public void display() {
System.debug('This is a shape.');
}
}
Rectangle Class:
public class Rectangle extends Shape {
private Decimal width;
private Decimal height;
// Constructor
public Rectangle(Decimal w, Decimal h) {
width = w;
height = h;
}
// Implementing the abstract method to calculate the area of the rectangle
public Decimal calculateArea() {
return width * height;
}
}
Circle Class:
public class Circle extends Shape {
private Decimal radius;
// Constructor
public Circle(Decimal r) {
radius = r;
}
// Implementing the abstract method to calculate the area of the circle
public Decimal calculateArea() {
return 3.14 * radius * radius;
}
}
Apex Codes for Usage:
Shape rectangle = new Rectangle(5, 10);
System.debug('Rectangle area: ' + rectangle.calculateArea()); // Output: 50
Shape circle = new Circle(7);
System.debug('Circle area: ' + circle.calculateArea()); // Output: 153.86
Video
Video does not exists.