Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Question (non-spoiler) on assignment six

 
Ranch Hand
Posts: 235
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been putzing through the Cattle Ranch assignments, and ran into ... discrepency, for lack of a better work. The assignment is to calculate the number of grains of wheat on each square of a chessboard (garnered from an ancient parable). The main objective was to find a certain API call. Easy enough, although I need to learn to read... would have made using this call a whole lot easier.

My question is this: the instructor's version took 35 lines to solve; whereas my solution was 7 lines of actual code plus three lines of '}' . What am I missing? Adding a pretty formatting to the output would only involve one or 2 more lines of code. So what did overlook. There are no detailed instructions; at least not that I can see.

If this is a fee-based question, or too much of a spoiler, I understand. But, I am curious as to what purpose of the additional 20some lines of code.

Regards,
Robert
 
Saloon Keeper
Posts: 10649
227
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert,

It's been a long time since I went through the nitpicking process myself, a quick solution I just wrote counts roughly 20 lines. That's including empty lines, boilerplate and braces. Admittedly, the style guide that the Cattle Drive uses is a bit less terse than what I usually write.

Your styling could be different from the one the nitpickers mandate, or you could be overlooking the fact that the output for the first square is a special case.

Either way, for a conclusive answer you should take it up with your nitpicker.
 
Bartender
Posts: 1842
13
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To solve the assignment and get the instructor solution, your solution may be different than the solution given by the trailboss.

The number of lines is a serving suggestion so folks don't go crazy writing too much code.
 
Robert D. Smith
Ranch Hand
Posts: 235
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Janeice DelVecchio wrote:The number of lines is a serving suggestion so folks don't go crazy writing too much code.



Ah, that's my problem; I took it as a challenge.
 
You can't expect to wield supreme executive power just because
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!