Computer Science, asked by anaborah77, 5 months ago

A library charges fine for books returned late. following are the fines:
First 5 days : 40p per day
6 to 10days : 65p per day
Above 10 days : 80p per day

design a class in Java to calculate the fine assuming that a book is returned N days late.​

Answers

Answered by anindyaadhikari13
16

Answer:-

This is the required program.

import java.util.*;

class Library_Fine

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter the number of days: ");

int d=sc.nextInt(),m=0;

if(d<=5)

m=d*40/100.0;

else if(d<=10)

m=d*65/100.0;

else

m=d*80/100.0;

System.out.println("Fine: "+m);

}

}

Similar questions