(wL) Forums
Does anyone know how to do this c++ problem - Printable Version

+- (wL) Forums (https://war-lords.net/forum)
+-- Forum: Resources (https://war-lords.net/forum/forum-31.html)
+--- Forum: Programming (https://war-lords.net/forum/forum-33.html)
+--- Thread: Does anyone know how to do this c++ problem (/thread-14993.html)

Pages: 1 2 3


RE: Does anyone know how to do this c++ problem - BlooD ZonE - Feb 04 2015

Make a system for X ; Y ; Z to get you this--->
X: Money paid $/€
Y: Hours you get from dealing with your internet provider (h)
Z: Internet speed measurment that you're surfing for the proportionality of its use

By making this system and getting the right number for x , y , z , you have to make Delta for it and divide your x into 2 parts. So calculating the "derivée" of x and Expotatienl primitive of z.

Here you can know how much you're ISP works for C++ on your own surfing rules approx.


RE: Does anyone know how to do this c++ problem - Dragon - Feb 04 2015

(Feb 04 2015, 04:32 AM)BlooD ZonE Wrote: Make a system for X ; Y ; Z to get you this--->
X: Money paid $/€
Y: Hours you get from dealing with your internet provider (h)
Z: Internet speed measurment that you're surfing for the proportionality of its use

By making this system and getting the right number for x , y , z , you have to make Delta for it and divide your x into 2 parts. So calculating the "derivée" of x and Expotatienl primitive of z.

Here you can know how much you're ISP works for C++ on your own surfing rules approx.
didnt know you do programming. >.>


RE: Does anyone know how to do this c++ problem - BlooD ZonE - Feb 04 2015

(Feb 04 2015, 04:34 AM)Dragon Wrote:
(Feb 04 2015, 04:32 AM)BlooD ZonE Wrote: Make a system for X ; Y ; Z to get you this--->
X: Money paid $/€
Y: Hours you get from dealing with your internet provider (h)
Z: Internet speed measurment that you're surfing for the proportionality of its use

By making this system and getting the right number for x , y , z , you have to make Delta for it and divide your x into 2 parts. So calculating the "derivée" of x and Expotatienl primitive of z.

Here you can know how much you're ISP works for C++ on your own surfing rules approx.
didnt know you do programming. >.>

Lol your doing the same steps like nats Tongue , i do by time.. Tongue


RE: Does anyone know how to do this c++ problem - .kevlar - Feb 04 2015

(Feb 03 2015, 01:27 AM)IEatPau Wrote: No idea what c++ is just doing this with basic maths cause im bored.
a) $35 for 25 hrs not including additional
b) $44.70 for 40 hours not inc additional
c) Get C
Sorry i couldnt help Big Grin

haha its cool man


RE: Does anyone know how to do this c++ problem - .kevlar - Feb 04 2015

(Feb 03 2015, 04:58 AM)Dragon Wrote: Let number of hours be x;
let monthly charge be y;
make a switch case for the choices
then according to the pick calculate the monthly charge
if else loops would be used here
compare the x with the given number of hours in choice like
if(x<=5) elseif(5<x<21)
like this you can calculate the monthly charge.
hope i helped
i might be wrong though Big Grin

thanks for effort! Smile


RE: Does anyone know how to do this c++ problem - .kevlar - Feb 04 2015

(Feb 04 2015, 04:32 AM)BlooD ZonE Wrote: Make a system for X ; Y ; Z to get you this--->
X: Money paid $/€
Y: Hours you get from dealing with your internet provider (h)
Z: Internet speed measurment that you're surfing for the proportionality of its use

By making this system and getting the right number for x , y , z , you have to make Delta for it and divide your x into 2 parts. So calculating the "derivée" of x and Expotatienl primitive of z.

Here you can know how much you're ISP works for C++ on your own surfing rules approx.

ayyye thanks Elie! I appreciate the help Smile


RE: Does anyone know how to do this c++ problem - Dragon - Feb 04 2015

(Feb 04 2015, 04:38 AM)BlooD ZonE Wrote:
(Feb 04 2015, 04:34 AM)Dragon Wrote:
(Feb 04 2015, 04:32 AM)BlooD ZonE Wrote: Make a system for X ; Y ; Z to get you this--->
X: Money paid $/€
Y: Hours you get from dealing with your internet provider (h)
Z: Internet speed measurment that you're surfing for the proportionality of its use

By making this system and getting the right number for x , y , z , you have to make Delta for it and divide your x into 2 parts. So calculating the "derivée" of x and Expotatienl primitive of z.

Here you can know how much you're ISP works for C++ on your own surfing rules approx.
didnt know you do programming. >.>

Lol your doing the same steps like nats Tongue , i do by time.. Tongue
really? what do u do? student? or already work?
btw nats who?


RE: Does anyone know how to do this c++ problem - SNSDJessica - May 04 2015

Hire a programmer Smile


RE: Does anyone know how to do this c++ problem - Call me when humans go extinct - May 04 2015

(Feb 04 2015, 06:13 AM)Dragon Wrote:
(Feb 04 2015, 04:38 AM)BlooD ZonE Wrote:
(Feb 04 2015, 04:34 AM)Dragon Wrote:
(Feb 04 2015, 04:32 AM)BlooD ZonE Wrote: Make a system for X ; Y ; Z to get you this--->
X: Money paid $/€
Y: Hours you get from dealing with your internet provider (h)
Z: Internet speed measurment that you're surfing for the proportionality of its use

By making this system and getting the right number for x , y , z , you have to make Delta for it and divide your x into 2 parts. So calculating the "derivée" of x and Expotatienl primitive of z.

Here you can know how much you're ISP works for C++ on your own surfing rules approx.
didnt know you do programming. >.>

Lol your doing the same steps like nats Tongue , i do by time.. Tongue
really? what do u do? student? or already work?
btw nats who?

Just a simple math question, don't even need a program to do the work.


RE: Does anyone know how to do this c++ problem - M. Bison - May 05 2015

Keane Wrote:Hire a programmer Smile
way to necro a topic Dodgy

.kevlar Wrote:An ISP has 3 different subscription packages...
I like how no one posted any code. Tongue

Here's something I put together in 15 mins:

Code:
#include <stdio.h>
#include <math.h>

double PackageA(int hours)
{
   double cost = 19.95;

   // 5-20 hours @ 0.75 extra
   cost += fmax(0, (fmin(hours, 20) - 5) * 0.75);

   // 20+ hours @ 1.00 extra
   cost += fmax(0, (hours - 20) * 1.00);

   return cost;
}

double PackageB(int hours)
{
   double cost = 24.95;

   // 15-25 hours @ 0.75 extra
   cost += fmax(0, (fmin(hours, 25) - 15) * 0.75);

   // 25+ hours @ 0.50 extra
   cost += fmax(0, (hours - 25) * 0.50);

   return cost;
}

double PackageC(int hours)
{
   return 29.75;
}

int main()
{
   // repeat forever!
   while (1)
   {
       printf("How many hours?\n");
       int hours;
       scanf("%i", &hours);

       double A_Total = PackageA(hours);
       double B_Total = PackageB(hours);
       double C_Total = PackageC(hours);

       char package;
       double cost;

       // repeat until valid package
       while(1)
       {
           printf("What package: A, B, or C?\n");
           scanf(" %c", &package);
           package = toupper(package);

           if (package == 'A')
           {
               cost = A_Total;
           }
           else if (package == 'B')
           {
               cost = B_Total;
           }
           else if (package == 'C')
           {
               cost = C_Total;
           }
           else
           {
               printf("invalid package...\n");
               continue;
           }

           break;
       }

       printf("----------------\n");
       printf("Package %c; Hours %i; Cost %.2f\n", package, hours, cost);

       // determine cheapest package
       if (A_Total >= B_Total)
       {
           if (B_Total >= C_Total)
           {
               printf("Cheapest Package: C\n");
           }
           else
           {
               printf("Cheapest Package: B\n");
           }
       }
       else if (A_Total >= C_Total)
       {
           printf("Cheapest Package: C\n");
       }
       else
       {
           printf("Cheapest Package: A\n");
       }

       printf("----------------\n");
   }

   return 0;
}