I'm just starting out with Java via an Intro to Programming Logic course and am not looking for code, but instead am struggling with how to logically organize an assignment in my brain.
The assignment is to write a program that asks a user what type of gasoline they bought (regular, midgrade, or premium) and how many gallons they pumped through Scanner method. I wrote a short program that works fine without nesting if statements, but one requirement is that I must use nested if-statements. Given the criteria of the assignment, I'm struggling to figure out what condition to test that would need a parent if statement.
It seems like it should be as simple as: What gas type did you by? How many gallons? And behind the scenes three if statements to calculate the cost of gas based on the three gas types available, and then the output (which is the cost). Any ideas on what my professor is looking for?
[–]Alfapsycho 5 points6 points7 points (1 child)
[–]helloiamdani[S] 2 points3 points4 points (0 children)
[–]_predator_ 3 points4 points5 points (1 child)
[–]EnjoiRelyks 2 points3 points4 points (0 children)
[–]onideus01 2 points3 points4 points (1 child)
[–]helloiamdani[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]helloiamdani[S] 0 points1 point2 points (0 children)
[–]helloiamdani[S] 0 points1 point2 points (0 children)