Win a copy of Java Challengers this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Methods not returning

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have amended some code as part of an assignment.

I am trying to return a productivity value and a message, the idea of the program is to pay a worker per part produced, this works, but for some reason, my productivity value is returned as 0 and string as null
I am leaving the parts as a double as the part is a final part so its a measure of final assembly ie 5.50 parts is 5 parts and 50 percent of a 6th . ie more assembly is needed for the 6th part.

I aim to tidy this up later I apologize for  any sloppiness


 
Master Rancher
Posts: 4284
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you copy the program's output and paste it here to show what you are asking about?

I am trying to return  ...


What method(s) are you asking about?  Where are those methods called and what values do they return?
 
Dave Bourke
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
UPDATE
DUH I should have been creating individual methods i created a method and passed that to my to string
it works
 
Marshal
Posts: 72657
317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done sorting that out, and welcome to the Ranch

Please sort out your indentation and spacing, otherwise you are liable to lose marks. Also break your longer lines into several shorter lines (e.g. line 109).
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic