Hello coders. so I have here a code that works great, but here is a little issue I'm having. When input 123456789 for "Enter price of each copy:" and 50 for "Estimated number of copies sold:". The answer I get is 617283945.00, however; the answer is supposed to be 864189523.00. Here is my code:
I manually did the calculations on my pc calculator and also got 617..... So it seems rigght for me. Running the program it printed "Option2 is the best..."
Your model answer is wrong. You will get the intended answer if you reverse the inputs and assume that the unit cost is 50 and you sold 123456789 of them. Otherwise, somebody would have grossly overpriced their book!
"The publisher is offering three options. In the first option, the author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. In the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. In the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000."
Your code is also wrong, since it won't set "tenPercent" if copiesSold is greater than 4000, or "fourteenPercent" if copiesSold is less than 4000. The calculation formula for 14% is also bracketed incorrectly.
If the largest two options are equal then your code won't produce a final answer.
In the following code I reversed the inputs to get the "intended" answer.