Note that there are some explanatory texts on larger screens.

plurals
  1. POparameters and calling methods to print
    primarykey
    data
    text
    <p>I am doing a programming course but my recent homework is causing me some problems as I'm being asked to do things which I have no idea how.</p> <p>One of my questions</p> <p>A method called printResult() that takes an integer representing the final score at a computer game and a boolean indicating whether the player won or not. If the player won, the method should print. Player 1 wins with point(s) Otherwise Player 1 loses with point(s)</p> <pre><code>void printResult(boolean winner, int score){ if(winner == true) println("Player 1 wins with " + score + " point(s)"); else println("Players 1 loses with " + score + " point(s)"); } </code></pre> <p>That's all I have so far.</p> <p>I don't know how to set the code up to read if the player wins or not as I don't have the scores.</p> <p>Also I'm having issues getting Java to return two figures as one instead of 1+2 = 3 I need it to return 12. so return 1 + 2 doesn't work.</p> <p>and lastly how do I get Java to print information from other methods?</p> <p>I have a question where I need to print a line that takes information from 2 other methods I've made.</p> <p>Now write a method called getPersonDescription() that takes a name, a boolean indicating whether the person is female (if true, male if false), and that person’s age. The method should return a String like this: James is middle aged. At 35 he has 30 years left until he is geriatric. Or, if the parameters were different the return value might be. Sally is a teenager. At 14 she has 6 years left until she is a young adult.</p> <p>Fairly obviously the method should use calls to getMaturityLevel() and yearsUntilNextMaturityLevel() to achieve part of its task. Note that the method will never be used to describe people who are already antique.</p> <p>Thankyou in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload