GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   C Programmers: 10min job for you (https://gfy.com/showthread.php?t=403726)

BackToMine 12-16-2004 09:44 AM

C Programmers: 10min job for you
 
I've got an assignment to hand in tommorow for my software solutions module and I havn't started it :mad:

It's nothing more than loops and if/else statements and won't be more than 70 lines!

You'll be paid via PayPal $30 :thumbsup :thumbsup

If you're interested post below and I'll paste the spec

BackToMine 12-16-2004 10:13 AM

bump
easy money for a quickie :thumbsup

colpanic 12-16-2004 10:14 AM

Lazy bastard!

I'll do it for $100 though :)

BackToMine 12-16-2004 10:16 AM

Quote:

Originally posted by colpanic
Lazy bastard!

Yup, I missed most of the C lectures.

Quote:


I'll do it for $100 though :)

Wow, its a no-brainer, actually it might insult a good C programmer because its that easy

I'm a Python programmer so it'll take me 10mins to do :)

Femme Fa'tale 12-16-2004 10:19 AM

Let me see the specs ...

BackToMine 12-16-2004 10:21 AM

Quote:

Implement a program to calculate charges for long-distance telephone calls according to the following scheme.

The regular charge is £1.50 for the first three minutes (or part thereof) and 30p for any minute after the first three. Rates are reduced during certain times of the day according to the following table:

Starting Time Monday to Friday Saturday and Sunday
Before 8am 40% discount 60% discount
8am to 6pm (inclusive)Regular rate 60% discount
After 6pm 40% discount 60% discount

The input to the program is to consist of the day on which the call was begun, the starting time of the call and the end time of the call. No call is to be greater than ten hours duration.

The day is to be indicated by using a key letter: (M)onday, T(u)esday, (W)ednesday, (T)hursday, (F)riday, S(a)turday, (S)unday.

The times are to be entered to the nearest minute using a 24 hour clock format. Each time should consist of two parts - hours and minutes. Midnight is 00 hours 00 minutes. 1:35pm is represented as 13 hours and 35 minutes.

The program is to display the day of the week as a full name, the call duration in minutes and the total charge.

The program should execute in a loop and so consideration must be given to how the processing requirements are to end.

Complete the program by including a summary analysis which will determine the total number of calls made, the total duration of the calls and the total cost of the calls.

Femme Fa'tale 12-16-2004 10:31 AM

I don't think it will take 10 min to do it... Do you have the formula for the day of the week and time?

BackToMine 12-16-2004 10:36 AM

Quote:

Originally posted by Femme Fa'tale
I don't think it will take 10 min to do it... Do you have the formula for the day of the week and time?
How much longer would you reckon?

It's a simple prog and this is the marking criteria:

Quote:

1) Correctly defines day of week
2) Correctly defines duration and charge
2a) Simple time differences
2b) End minutes < start minutes
2c) End hour < start hour
3) Correctly incorporates an appropriate control loop
4) Correctly calculates and displays summary totals
5) Input validation
:thumbsup

Femme Fa'tale 12-16-2004 10:42 AM

I made a program before :

Input: Birthdate >>> Output : day of a Week you were born

and

Time (in DOS)

I think the formula will help you...

BackToMine 12-16-2004 10:50 AM

It's the C syntax I have to get used to that I don't have time for tonight.

I think it'll work like this:

1) User inputs day via letter eg. M for monday, T for tuesday etc.
2) User inputs start time in 24hr format eg. 13:20
3) User inputs end time in 24hr format eg. 13:34
4) Program calculates cost based upon table for discounts
5) Displays total cost, the day and call length

6) Asks whether to loop, if so then back to step1
7) Calculates total summary analysis with no# of calls and total call durations and total cost of all calls
8) Finished
:thumbsup

colpanic 12-16-2004 11:19 AM

Certainly not hard, but still an hour or two if you want it to be pretty.

You are right though, in Python or Ruby it would be a lot quicker :)

Really not worth it for 30 bucks though, seriously.

Danny 12-16-2004 11:22 AM

Hit me up on icq I may know someone who would be willing to do it for you...

BackToMine 12-16-2004 11:25 AM

OK, if it'll cost more then I'll drive over to my classmate tonight and steal his code :winkwink:

Thank god its not supposed to be in ASM :1orglaugh

Femme Fa'tale 12-16-2004 11:29 AM

Check this out ... just add a function for total calls , how much and how many min ...

http://www.informatics.susx.ac.uk/co...solution2.html

Note : Calling Time may vary in the computer you are using ...

Danny 12-16-2004 01:19 PM

Still waiting to hear from you. Got bored and got it finished for you already... icq 9770313

romaninsh 12-16-2004 01:51 PM

Code:

#include <stdio.h>
#include <stdlib.h>

int starting_min;
int ending_min;
int min;
char d;

int mpm;

int hour_cost(){
        int cost;
        int weekend;
        int discount;
        if(mpmhahahaha0){
                // first minute
                cost=150;
        }else if(mpm<3){
                // 2nd or 3rd minute
                cost=0;
        }else{
                cost=30;
        }
        mpm++;

        // apply discounts
        weekend = (dhahahaha'a' || dhahahaha'S');

        if(weekend){
                discount=60;
        }else{
                if(min<8*60)discount=40;
                else if(min<=18*60)discount=0;
                else discount=40;
        }
        cost=cost-cost*discount/100;
        return cost;
}

int main(){
        char d;
        int m,h,m2,h2;
        int cost;
        while(scanf("%c %d:%d %d:%d",&d,&h,&m,&h2,&m2)){
                starting_min = h*60+m;
                ending_min = h2*60+m2;
               
                printf("%d - %d\n",starting_min,ending_min);
                mpm=0;cost=0;
                for(min=starting_min;min<ending_min;min++){
                        cost+=hour_cost(min);
                }
               
                printf("%.2f\n",(float)cost/100);
        }
        return EXIT_SUCCESS;
}


Try this out. I don't have much time, so i did only quick tests. It took me 17 minutes, btw ;))

:1orglaugh :1orglaugh :1orglaugh

hit me up if you need any help.

romaninsh 12-16-2004 01:57 PM

oh, board messed up the code..

you can download it here:
http://romans.adevel.com/cd.c

romans

jawanda 12-16-2004 01:58 PM

Quote:

Originally posted by romaninsh
Code:

#include <stdio.h>
#include <stdlib.h>

int starting_min;
int ending_min;
int min;
char d;

int mpm;

int hour_cost(){
        int cost;
        int weekend;
        int discount;
        if(mpmhahahaha0){
                // first minute
                cost=150;
        }else if(mpm<3){
                // 2nd or 3rd minute
                cost=0;
        }else{
                cost=30;
        }
        mpm++;

        // apply discounts
        weekend = (dhahahaha'a' || dhahahaha'S');

        if(weekend){
                discount=60;
        }else{
                if(min<8*60)discount=40;
                else if(min<=18*60)discount=0;
                else discount=40;
        }
        cost=cost-cost*discount/100;
        return cost;
}

int main(){
        char d;
        int m,h,m2,h2;
        int cost;
        while(scanf("%c %d:%d %d:%d",&d,&h,&m,&h2,&m2)){
                starting_min = h*60+m;
                ending_min = h2*60+m2;
               
                printf("%d - %d\n",starting_min,ending_min);
                mpm=0;cost=0;
                for(min=starting_min;min<ending_min;min++){
                        cost+=hour_cost(min);
                }
               
                printf("%.2f\n",(float)cost/100);
        }
        return EXIT_SUCCESS;
}


Try this out. I don't have much time, so i did only quick tests. It took me 17 minutes, btw ;))

:1orglaugh :1orglaugh :1orglaugh

hit me up if you need any help.

You are the shit, Roman!

If anyone needs any php, javascript, or other programming done I highly recommend you write down Romans ICQ number right now. His prices are great and his work is top notch. :thumbsup

Femme Fa'tale 12-16-2004 02:00 PM

:error missing output ?

BackToMine 12-16-2004 02:32 PM

Quote:

Originally posted by romaninsh

you can download it here:
http://romans.adevel.com/cd.c


That's excellent romans! :thumbsup

In fact had my ICQ been working, you were just the person I would have contacted since I saw your ICQ number when logging into Chokertraffic admin page! :1orglaugh

All I need now is to add some comments to the code and do the proper documentation (pseudo code, Jackson Structure Diagrams, test plans, etc.) and I'm done!

If you want the $$ then reply with your PayPal address :)

Quote:

Originally posted by Femme Fa'tale
missing output ?
Seems to work here, enter "M 13:22 13:29" when it executes.

BackToMine 12-16-2004 02:33 PM

Quote:

Originally posted by Danny
Still waiting to hear from you. Got bored and got it finished for you already... icq 9770313
Sorry I didn't get into contact with you, my ICQ hasn't been working for some strange reason and have been meaning to fix it.

Femme Fa'tale 12-16-2004 02:38 PM

Good for you man !:thumbsup

BackToMine 12-16-2004 02:40 PM

Quote:

Originally posted by Femme Fa'tale
Good for you man !:thumbsup
Thanks for trying to help :thumbsup

romaninsh 12-16-2004 02:53 PM

Quote:

Originally posted by BackToMine

If you want the $$ then reply with your PayPal address :)

Sorry, i don't have PayPal account, only epassporte. The task was interested, so i did it for fun.

romans

BackToMine 12-16-2004 02:56 PM

Quote:

Originally posted by romaninsh
Sorry, i don't have PayPal account, only epassporte. The task was interested, so i did it for fun.

romans

That's cool then, I'll be sure to mention your name if anyone wants any C/PHP work done on gfy :thumbsup


All times are GMT -7. The time now is 11:14 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123