Forums Register Login

Simple exercise

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
 

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!
+Pie Number of slices to send: Send
Somebody agrees with me!! Welcome to JavaRanch, Cheng Jian.
get schwifty. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1338 times.
Similar Threads
Dan's Mock Comp. Exam 15, Question 24
Mock exam question regarding inheritance plz explain this output
Inheritance question
Check for invalid file name
Dan's question - clarify!!!
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:08:14.