My issue
i want solution
My code
class Codechef{
public static void main(String[] args) {
// Initialize variables
double sideLength = 14.0; // side length of the square
double area; // variable to store the area
double paintCostPerSquareCm = 7.0; // paint cost per square cm
double cost; // variable to store the cost of painting
// Calculate the area of the square
area = sideLength * sideLength;
// Calculate the cost of painting the square
cost = area * paintCostPerSquareCm;
// Output the area and cost to the console on separate lines
System.out.println("Area of the square with side length " + sideLength + " cm: " + area + "cm^2");
System.out.println("Cost of painting the square: $" + cost);
}
}
Learning course: Placement preparation using Java
Problem Link: CodeChef: Practical coding for everyone