Cleanup examples.

This commit is contained in:
Erik C. Thauvin 2020-09-09 00:34:27 -07:00
parent 5de9d7b5e0
commit 12855c5b3e
2 changed files with 4 additions and 4 deletions

View file

@ -16,7 +16,8 @@ public class ReadingTimeSample {
rt.setPlural("minutes to read"); rt.setPlural("minutes to read");
System.out.println("It will take " + rt.calcReadingTime() + ' ' + ReadingTime.wordCount(rt.getText()) System.out.println("It will take " + rt.calcReadingTime() + ' ' + ReadingTime.wordCount(rt.getText())
+ " words and " + ReadingTime.imgCount(rt.getText()) + " images."); + " words and " + ReadingTime.imgCount(rt.getText()) + " images at " + rt.getWpm()
+ " words per minute.");
} catch (IOException e) { } catch (IOException e) {
System.err.println("The file could not be read or found."); System.err.println("The file could not be read or found.");
} }

View file

@ -1,8 +1,6 @@
package com.example package com.example
import net.thauvin.erik.readingtime.ReadingTime import net.thauvin.erik.readingtime.ReadingTime
import net.thauvin.erik.readingtime.ReadingTime.Companion.imgCount
import net.thauvin.erik.readingtime.ReadingTime.Companion.wordCount
import java.io.File import java.io.File
fun main(args: Array<String>) { fun main(args: Array<String>) {
@ -14,7 +12,8 @@ fun main(args: Array<String>) {
rt.plural = "minutes to read" rt.plural = "minutes to read"
println( println(
"It will take ${rt.calcReadingTime()} ${wordCount(rt.text)} words and ${imgCount(rt.text)} images." "It will take ${rt.calcReadingTime()} ${ReadingTime.wordCount(rt.text)} words and " +
"${ReadingTime.imgCount(rt.text)} images at ${rt.wpm} words per minute."
) )
} else { } else {
System.err.println("The file could not be read or found.") System.err.println("The file could not be read or found.")