C Programmers: 10min job for you

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BackToMine
    Confirmed User
    • Nov 2004
    • 541

    #1

    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

    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

    If you're interested post below and I'll paste the spec
  • BackToMine
    Confirmed User
    • Nov 2004
    • 541

    #2
    bump
    easy money for a quickie

    Comment

    • colpanic
      Confirmed User
      • May 2004
      • 1007

      #3
      Lazy bastard!

      I'll do it for $100 though
      I like ducks.

      Comment

      • BackToMine
        Confirmed User
        • Nov 2004
        • 541

        #4
        Originally posted by colpanic
        Lazy bastard!
        Yup, I missed most of the C lectures.


        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

        Comment

        • Femme Fa'tale
          Confirmed User
          • Nov 2004
          • 541

          #5
          Let me see the specs ...

          Comment

          • BackToMine
            Confirmed User
            • Nov 2004
            • 541

            #6
            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.

            Comment

            • Femme Fa'tale
              Confirmed User
              • Nov 2004
              • 541

              #7
              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?

              Comment

              • BackToMine
                Confirmed User
                • Nov 2004
                • 541

                #8
                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:

                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

                Comment

                • Femme Fa'tale
                  Confirmed User
                  • Nov 2004
                  • 541

                  #9
                  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...

                  Comment

                  • BackToMine
                    Confirmed User
                    • Nov 2004
                    • 541

                    #10
                    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

                    Comment

                    • colpanic
                      Confirmed User
                      • May 2004
                      • 1007

                      #11
                      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.
                      I like ducks.

                      Comment

                      • Danny
                        Confirmed User
                        • Apr 2002
                        • 198

                        #12
                        Hit me up on icq I may know someone who would be willing to do it for you...
                        - Danny
                        ICQ# 9770313

                        Comment

                        • BackToMine
                          Confirmed User
                          • Nov 2004
                          • 541

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

                          Thank god its not supposed to be in ASM

                          Comment

                          • Femme Fa'tale
                            Confirmed User
                            • Nov 2004
                            • 541

                            #14
                            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 ...

                            Comment

                            • Danny
                              Confirmed User
                              • Apr 2002
                              • 198

                              #15
                              Still waiting to hear from you. Got bored and got it finished for you already... icq 9770313
                              - Danny
                              ICQ# 9770313

                              Comment

                              • romaninsh
                                Registered User
                                • Aug 2003
                                • 39

                                #16
                                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 ;))



                                hit me up if you need any help.
                                A proud developer of ChokerTraffic and TTT-C (ICQ: 266-606-026)

                                Comment

                                • romaninsh
                                  Registered User
                                  • Aug 2003
                                  • 39

                                  #17
                                  oh, board messed up the code..

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

                                  romans
                                  A proud developer of ChokerTraffic and TTT-C (ICQ: 266-606-026)

                                  Comment

                                  • jawanda
                                    Confirmed User
                                    • Feb 2003
                                    • 6040

                                    #18
                                    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 ;))



                                    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.

                                    Comment

                                    • Femme Fa'tale
                                      Confirmed User
                                      • Nov 2004
                                      • 541

                                      #19
                                      missing output ?

                                      Comment

                                      • BackToMine
                                        Confirmed User
                                        • Nov 2004
                                        • 541

                                        #20
                                        Originally posted by romaninsh

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

                                        That's excellent romans!

                                        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!

                                        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

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

                                        Comment

                                        • BackToMine
                                          Confirmed User
                                          • Nov 2004
                                          • 541

                                          #21
                                          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.

                                          Comment

                                          • Femme Fa'tale
                                            Confirmed User
                                            • Nov 2004
                                            • 541

                                            #22
                                            Good for you man !

                                            Comment

                                            • BackToMine
                                              Confirmed User
                                              • Nov 2004
                                              • 541

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

                                              Comment

                                              • romaninsh
                                                Registered User
                                                • Aug 2003
                                                • 39

                                                #24
                                                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
                                                A proud developer of ChokerTraffic and TTT-C (ICQ: 266-606-026)

                                                Comment

                                                • BackToMine
                                                  Confirmed User
                                                  • Nov 2004
                                                  • 541

                                                  #25
                                                  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

                                                  Comment

                                                  Working...