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

 

orion.a.smith@gmail.com apcsa-primitives > apcsaPrimitivesDivideFractionString
prev  |  next  |  chance

Given a String representing a fraction in the form "numerator/denominator", extract the numerator and denominator and return the result of double division of the numerator by the denominator.


HINT: use Integer.parseInt() or Double.parseDouble() to collect a String into a primitive value.  Use indexOf and substring to figure out where the start and end of the input happens.

apcsaPrimitivesDivideFractionString("3/4") → 0.75
apcsaPrimitivesDivideFractionString("1/2") → 0.5
apcsaPrimitivesDivideFractionString("-1/4") → -0.25

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

public double apcsaPrimitivesDivideFractionString(String str) { }

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: 150

Copyright Nick Parlante 2017 - privacy