[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math

Search:


View post   

>> No.5578470 [View]
File: 25 KB, 384x365, 1321661782812.jpg [View same] [iqdb] [saucenao] [google]
5578470

Any compsci bros in here?

I'm a total beginner and I just wrote this big program and it compiles and stuff but there's one math error.

Here's the part that is ruining me:
>For example, for a package that weighs 22 pounds that is being
>shipped 55 miles, you should charge the individual $20.67
>because: you should charge $6.89 (based on the weight) for the
>first 25 miles, $6.89 for the second 25 miles and another $6.89 for
>the remaining 5 miles, which is a fraction of 25 miles. Do not prorate >the shipping charges based on partial mileage (like 5/25
miles).

In this example, how would I add in the extra $6.89 for the last 5 miles?

I tried to skeez it and do:
>cost = (rate * (distance/25));

But that leaves out the last thingy that I need to incorporate.

>> No.3827676 [View]
File: 25 KB, 384x365, utryintochaetme.jpg [View same] [iqdb] [saucenao] [google]
3827676

>>3827414

Navigation
View posts[+24][+48][+96]