Library

Library - IO.reportBadInput if(lateDays == 0 penalty = 0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Library { public static void main(String[] args) { int lateDays; double bookFee; double penalty; System.out.println("Please enter the late days:"); lateDays = IO.readInt(); if(lateDays < 0) { IO.reportBadInput(); } System.out.println("Please enter the fee for the book:"); bookFee = IO.readDouble(); if(bookFee < 0) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: IO.reportBadInput(); } if (lateDays == 0) { penalty = 0; } else { if (lateDays <= 7) { penalty = lateDays * 0.1; } else if ((lateDays >7) && (lateDays <= 90)) { penalty = 0.7 + (lateDays - 7) * 0.2; } else { penalty = 10 + bookFee; } } IO.outputDoubleAnswer(penalty); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online