How to change variables elegantly?

How do I get one If to change two variables (Java)?

  • My program is an assignment for helping choose phone plans. I want the lines below to do this: Output: How many minutes does this plan offer? If the input is zero, then the phone plan has unlimited minutes. So the variable planAminutes = 0 but I also want planAchargeMinutes, the variable dealing with overcharges for going over the number of minutes (but isn't needed since it's unlimited) to also = 0. The else function will input the number of minutes the plan offers. what I've got is: The output if (keyboard.nextInt() == 0) planAminutes = 0; else planAminutes=keyboard.nextInt(); How do I get the if statement to also alter a second variable?

  • Answer:

    sorry i cant help but it seems like your doing stuff more advanced than i am, would you be able to help me out with a java program?

Craig H at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.