• Post Reply Bookmark Topic Watch Topic
  • New Topic

Does my code satisfy the instructions for this assignment?  RSS feed

 
Natalie Oliver
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just need some peer review on my code. I am a beginner when it comes to Java. I appreciate your time.


 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

It took me about 8 seconds to find out about what kind of instructions you're talking about.
Probably you're referint to definitions or Java terms you have added as your print statements arguments.

Importable sounds a bit strange, but that is probably about right what you have actually in your mind.

Are these all instructions you were given? To write a small program and print out some of the definition as you understand them?
 
Natalie Oliver
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I was given some additional instructions. Sorry I forgot to include them!

INSTRUCTIONS: create an application that displays five words and the corresponding definition. place each word on a separate line followed by the definition. place a blank line between entries.
 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Natalie Oliver wrote:Yes, I was given some additional instructions. Sorry I forgot to include them!

INSTRUCTIONS: create an application that displays five words and the corresponding definition. place each word on a separate line followed by the definition. place a blank line between entries.
So, what are you missing from those? I see some inconsistencies between what you have and between what is asked.
 
Natalie Oliver
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I satisfied the instructions... I did add a blank line for each string using the \n.. but I may be wrong
 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Natalie Oliver wrote:I think I satisfied the instructions... I did add a blank line for each string using the \n.. but I may be wrong
Oh yes, you did add, I didn't notice that. So, and for terminology you can google, but in general, the definitions are quite good. Depending on your teacher, that could be not enough, might it is expected a bit more ellaboration. Don't know that.
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Natalie Oliver wrote:. . . I did add a blank line for each string using the \n.. . . .
Yes, that will introduce empty lines, but it is not good practice to use the \n character. Not even if lots of books show it. One way round that is to write System.out.println(); on its own but that will rapidly become tedious. Another way to do it is to replace println with printf and to include the %n tag inside the String at the appropriate location. When it doesn't work quite as you expected, use %n twice. Read about printf in the Java™ Tutorials, here and here. The System.out.format method and System.out.printf work exactly the same way. Since you have no other % tags, miss out the comma and everything else after the String.

And welcome to the Ranch again.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Natalie Oliver wrote:INSTRUCTIONS: create an application that displays five words and the corresponding definition. place each word on a separate line followed by the definition. place a blank line between entries.

The way I see it, those instructions could be interpreted in two ways:

First interpretation: the way you interpreted it --

Argument: data passed to a method for processing.

Bytecode: compiled Java source code.

Importable: package code that can be used by an application.

Class: the description of an object.

Syntax error: a statement that violates the rules of Java.


Second interpretation: Each word on a separate line (by itself) followed by the definition (on the line below), place a blank line between entry (word+definition) --

Argument
data passed to a method for processing.

Bytecode
compiled Java source code.

Importable
package code that can be used by an application.

Class
the description of an object.

Syntax error
a statement that violates the rules of Java.

You might just want to verify what the correct interpretation is with your instructor.
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junilu Lacar wrote:. . . those instructions could be interpreted in two ways: . . .
Each of which can be implemented very easily with printf and different numbers of %n tags.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!