//grading
float grade = -1.0F;
do {
System.out.print("Input your grade: ");
grade = grade.nextFloat();
if (grade < 0.0F || grade > 1.5F) {
System.err.println("Error: The grade must be between 0.0 and 1.5!");
}
} while (grade < 0.0F || grade > 1.5F);
It's done, but I want it to deal with some cases, like... if the guy inputs a name or something... is it possible to this in java?
holy fucking christ fag shit cock.
(define (fag)
((lambda (f)
(if (or (< f 0) (> f 1.5))
(begin
(display "Error: The grade must be between 0 and 1.5!")
(fag))
f)) (read)))
(define (main)
(begin
(display "Input your grade: ")
(display (fag))))
grade = do
putStrLn "Hello give me numbers"
grade <- read getLine
if grade > 1.5 or grade < 0
then putStrLn "Learn to count, chink"
else putStrLn ("Hey, your grade is" ++ grade ++ ", what do you want to do now?")
>>9
I made a typo, so fuck you. if you're saying that there's only one nextFloat() then maybe you're the idiot, lol?
Name:
Anonymous2008-02-06 13:29
This thread is not about Haskell. It is about Java.
Name:
Anonymous2008-02-06 13:34
>>14 I made a typo, so fuck you. if you're saying that there's only one nextFloat() then maybe you're the idiot, Look at angry man!
>, lol! Look at the fool!
Name:
Anonymous2008-02-06 13:34
I HAVE CREATED A BBCODE BUG, FORGIVE ME, MASTER
Name:
Anonymous2008-02-06 14:31
>>14
You can't look for a String input while getting floats from Scanner. Use something else instead, like a BufferedReader wrapping an InputStreamReader combined with a parseFloat().
Don't forget to catch exceptions.
Name:
Anonymous2008-02-06 15:13
Yeah, use a factory factory with a decorator pattern. And you can throw in a visitor, for good measure.
This thread is now about design patterns.
Name:
Anonymous2008-02-06 15:16
>>18
Or you could just use JOptionPane.showInputDialog(), if you want to abstract Java's cancer away a bit, and add a graphical interface. The important part is that you're reading plain Strings, not parsed floats.