id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

kingdom


int kingdom(hasNoNucleus, isSingleCell, doesPhotosynthesis, hasNervousSystem): based upon an organism's characteristics, returns a number representing its kingdom classification. If an organism has no cell nucleus, then it's a BACTERIA (return 2). If an organism is not a bacteria, but is single-celled, it is a PROTOZOA (return 3). If an organism is neither a bacteria nor a protozoa, but it is capable of photosynthesis, it is a PLANT (return 4). If an organism is not a bacteria, protozoa or plant, but does have a nervous system, then it is an ANIMAL (return 5). If an organism is none of the above four categories, then it is a FUNGUS (return 1). NOTE: No more than one of the input parameters will ever be true. RUBRIC: It is not enough to just solve the problem. Make sure you use PROPER INDENTATION. You MUST use CURLY BRACKETS for all loops and if/else statements. Also, the more EFFICIENT your solution, the higher your grade. If you have extraneous (superfluous / unnecessary) code, deductions will be taken.


kingdom(true, false, false, false) → 2
kingdom(false, true, false, false) → 3
kingdom(false, false, true, false) → 4

...Save, Compile, Run (ctrl-enter)

public int kingdom(boolean hasNoNucleus, boolean isSingleCell, boolean doesPhotosynthesis, boolean hasNervousSystem) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 4

Copyright Nick Parlante 2017 - privacy