aspose file tools*
The moose likes Beginning Java and the fly likes Simple exercise Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple exercise" Watch "Simple exercise" New topic
Author

Simple exercise

Logan Knecht
Greenhorn

Joined: Jun 05, 2008
Posts: 16
I'm doing exercise 4 on this site and just wanted some input.

http://chortle.ccsu.edu/CS151/Notes/chap14/progExercises14.html



How would I make it so that the pressure out of range if statement is a method?

Also would



work both ways for each tire so when that runs if either tire is + or - 3 psi it would detect it, or would I have to do it for the leftFront as well?

Any help is appreciated!

Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
Originally posted by Logan Knecht:
How would I make it so that the pressure out of range if statement is a method?

Also would



work both ways for each tire so when that runs if either tire is + or - 3 psi it would detect it, or would I have to do it for the leftFront as well?
1: Replace it with a statement like printPressureOK(frontLeft == frontRight); or similar.
2: Have a private static void printPressureOK(boolean pressureOK) method. Or something similar.
3: Not quite sure what you mean about the + or - but have you tried the Math.abs method?

Good luck with it
cheng jian
Greenhorn

Joined: Jul 28, 2008
Posts: 7
Originally posted by Campbell Ritchie:
1: Replace it with a statement like printPressureOK(frontLeft == frontRight); or similar.
2: Have a private static void printPressureOK(boolean pressureOK) method. Or something similar.
3: Not quite sure what you mean about the + or - but have you tried the Math.abs method?

Good luck with it


I agree with that!
Make a method to print.
good luck!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
Somebody agrees with me!! Welcome to JavaRanch, Cheng Jian.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple exercise
 
Similar Threads
Dan's question - clarify!!!
Mock exam question regarding inheritance plz explain this output
Dan's Mock Comp. Exam 15, Question 24
Inheritance question
Check for invalid file name