You are on page 1of 2

import java.util.

Scanner;

public class Main{

public static void main(String[] args){

Scanner sc=new Scanner(System.in);

System.out.println("Enter the length of the roof in meters");

double l=sc.nextDouble();

if(l<=0){

System.out.print("Invalid Length");

return;

System.out.println("Enter the breadth of the roof in meterd");

double b=sc.nextDouble();

if(b<=0){

System.out.println("invalid breadth");

return;

System.out.println("Enter the rainfall level");

double r=sc.nextDouble();

if(r<=0){

System.out.println("Invalid rainfall");

return;

double h;

h=(l*b)*(r*10);

System.out.format("%.2f",h);
System.out.printf(" "+"Liters");

You might also like