0

How would I write System.out.println("Marvin has " + total + " coins in total"); in pseudocode for an algorithm?

I feel like Print "Marvin has" + total + " coins in total is not really pseudocode?

This is for an algorithm question on a first year Java assignment

C14L
  • 12,153
  • 4
  • 39
  • 52
Brooke
  • 13
  • 4
  • 1
    [This](https://en.wikipedia.org/wiki/Pseudocode) might be of help. – RaminS May 27 '16 at 21:24
  • Why do you consider that not pseudocode? – azurefrog May 27 '16 at 21:24
  • Normally, when writing pseudocode, those details are neglected (after all, the output is just for us humans and is not essential for the computation). Also, where is the connection to Java? Pseudocode is meant to be language-independent. – Turing85 May 27 '16 at 21:25
  • Not really sure! I didn't know if it was okay to use the + in a print statement like that, but if it is then i'll leave it like it is! – Brooke May 27 '16 at 21:27
  • the only example I was given was: Print "The total is ", total – Brooke May 27 '16 at 21:28

1 Answers1

0

Pseudocode is designed to be human readable. There are no rules for what is and isn't "too close to actual code," just as long as it suits your audience. Usually, I try to write as if someone with zero coding experience is reading it, because that's what my clients would prefer. They might have no clue why there are " in that statement or what string concatenation is.

I would just write:

Print the total number of coins Marvin has to the console.

The best advice is to use what will make sense to those who are going to read it. It you're writing the pseudo-code for another Java programmer, they would have no issue with what you posted.

4castle
  • 32,613
  • 11
  • 69
  • 106