Twigz's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Active Members
Active Posts:
68 (0.06 per day)
Joined:
11-July 11
Profile Views:
1,176
Last Active:
User is offline Yesterday, 08:48 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Twigz has not set their status

Posts I've Made

  1. In Topic: A little help with my assignment

    Posted 29 Sep 2014

    View Postinfernorthor, on 29 September 2014 - 06:52 PM, said:

    I would go with my string idea. I will show part of main to get you started. Try to keep things simple. Make functions as you go, main should be easy to read if you use functions.

    //possible other functions
    void AskTime(char time[5]);
    int duration( char date1[11] , char date[11] );
    int getPrice( char date1[11] , char date[11] );
    
    void AskDate(char date[11])
    {
    	//query and set date
    }
    
    int main()
    {
    	char dateRented[11] = "";
    	char dateReturned[11] = "";
    
    	puts("Enter the date the bike was rented out [mm/dd/yyyy]");
    		AskDate(dateRented);
    
    	
    	return 0;
    }
    
    


    I'm guessing this requires knowledge of arrays? I haven't started on that topic as yet. And i'm still trying to figure out whats happening in there.

    Thank you #define, i think i understand what you mean now. That means i'll have to go through my code and try to adjust it. That will require alot of work. I'll try though.

    Thanks once again guys, a big help.
  2. In Topic: A little help with my assignment

    Posted 29 Sep 2014

    Here is the assignment, i thought i attached it

    Assignment 1
    Due: Oct 14, 2014 Tuesday 23:59 (Both sections)
    Completion of this assignment is a requirement for passing this course

    Learning Outcome

    Upon successful completion of this assignment, you will have demonstrated the abilities to:

    • code program logic using sequence, selection
    • perform arithmetic operations
    • read user input
    • write program output
    • design an algorithm to solve a small problem


    Introduction

    You are going to write a Bike Rental Charge Calculator

    The Big Bike Company rents out bikes and charge based on the length of time the bike was
    rented out for.

    General Specifications

    The rental cost is as follows:

    • up to 5 hours - $5
    • more than 5 hours but no more than 24 hours (24 hours are inclusive) - $12
    • for each additional hour (or portion of an hour) after the first 24 hours - $0.50


    Your program accepts the following information from the user:

    • The date the bike was rented out
    • The time the bike was rented out
    • The date the bike was returned
    • The time the bike was returned


    All dates are input in the format of mm/dd/yyyy, e.g., 09/23/2014 for September 23, 2014

    All times are input in the 24 hour format up to minutes as hh:mm, e.g, 23:59

    From the above information, your program must calculate and display the following:

    • duration of rental in number of hours and minutes
    • cost of the rental



    Don't forget to account for leap years!

    To determine if a year is a leap year, refer to the following rules (from
    http://www.timeandda...e/leapyear.html ):

    • The year is evenly divisible by 4 and...
    • If the year can be evenly divided by 100, it is NOT a leap year, unless...
    • The year is also evenly divisible by 400. Then it is a leap year.


    Sample Run

    Big Bike Company Bike Rental System

    ===================================

    Enter the date the bike was rented out [mm/dd/yyyy]- 02/27/2014

    Enter the time the bike was rented out [hh:mm] - 12:10



    Enter the date the bike was returned [mm/dd/yyyy]- 02/28/2014

    Enter the time the bike was returned [hh:mm] – 10:35



    Duration of Rental: 22 hours, 25 min

    Cost of Rental: $12.00

    Minimum Requirements for assignment to be considered complete

    • program must compile without errors on matrix and produce and executable
    • program must run without crashing
    • Using data listed in the table below, program produces the desired output (also listed
    below)
    • Faking of data is NOT allowed (ie if you use just printfs to create exactly the above
    output that would be considered faking your output)


    Rental day
    time

    Return day
    time

    Duration

    Cost of
    Rental

    Explanation

    Feb. 27,
    2014,
    13:10

    Feb. 28,
    2014,
    11:35

    22 hours,
    25 min

    $12.00

    explanation: rented out at 13:10, returned next day
    at 12:35, thus less than 24 hours but more than 5
    hours

    Apr. 10,
    2014,
    13:10

    Apr. 12,
    2014,
    11:35

    46 hours,
    25 min

    $23.50

    explanation: 46 hours and 25 min means that we
    round up to 47 hours for rental charge as portions
    of an hour are counted as a full hour

    Dec. 31,
    2013,
    23:59

    Jan. 1,
    2014, 2:59

    3 hours, 0
    min

    $5

    explanation: rented out for 3 hours... note that the
    day/time difference can stretch over to the next
    year

    Feb 28,
    2012,
    12:00

    March 1,
    2012,
    12:00

    48 hours, 0
    min

    $24

    explanation: 2012 is a leap year, so between Feb
    28 and March 1 is two days




    Feb 28,
    2000,
    12:00

    March 1,
    2000,
    12:00

    48 hours, 0
    min

    $24

    explanation: 2000 is a leap year, so between Feb
    28 and March 1 is two days

    Feb 28,
    2100,
    12:00

    March 1,
    2100,
    12:00

    24 hours, 0
    min

    $12

    explanation: 2100 is NOT leap year, so between
    Feb 28 and March 1 is one day



    NOTE: meeting this standard does not guarantee that your assignment will receive 100%. It only
    means it will be considered completed and will not need to be resubmitted
  3. In Topic: A little help with my assignment

    Posted 29 Sep 2014

    I'm honestly confused. Sorry. First you said: " Now you are checking two at once. You are checking both rent and return date and times. "

    int isDateValid ( int rentMonth, int rentDay, int rentYear, int returnMonth, int returnDay, int returnYear ) {
     
        int quit;
        if ((rentMonth > 0 && returnMonth > 0) && (rentMonth <= 12 && returnMonth <= 12)) {
            quit = 0;
        } else {
            printf("\nInvalid rent Month or return Month!!\n");
            quit = 1;
        }
     
        if ((rentDay > 0 && returnDay > 0) && (rentDay <= 31 && returnDay <= 31)) {
            quit = 0;
    
        } else {
            printf("\nInvalid rent Day or returnDay!!\n");
            quit = 1;
        }
     
        if ( rentYear > 0 && returnYear >= rentYear ) {
            quit = 0;
        } else {
            printf("\nInvalid rent Year or return Year!!\n");
            quit = 1;
        }
        return quit;
    }
    
    


    Checking both at the same time.
    So i changed i split it up to

    int isRentTimeValid ( int rentHour, int rentMinute ) {
    
        int invalid;
        if ( rentHour >= 0 && rentHour <= 23) {
            invalid = 0;
        } else {
            printf("\nInvalid rent Hour!!\n");
            invalid = 1;
        }
        if ( rentMinute >= 0 && rentMinute  <= 59) {
            invalid = 0;
        } else {
            printf("\nInvalid rent Minute!!\n");
            invalid = 1;
        }
        return invalid;
    }
    
    int isReturnTimeValid ( int returnHour, int returnMinute ) {
    
        int invalid;
        if (returnHour >= 0 && returnHour <= 23) {
            invalid = 0;
        } else {
            printf("\nInvalid return Hour!!\n");
            invalid = 1;
        }
        if (returnMinute >= 0 && returnMinute <= 59) {
            invalid = 0;
        } else {
            printf("\nInvalid return Minute!!\n");
            invalid = 1;
        }
        return invalid;
    }
    


    And now youre saying, These two functions do the exact same thing.
    Which is why you should just have ONE function.

    Was i supposed to make the change to this function rather than the above ones?

    int returnDateGreatRentDateCheck ( int rentMonth, int rentDay, int rentYear, int returnMonth, int returnDay, int returnYear, int currentMonth, int previousMonth, int rentHour, int rentMinute, int returnHour, int returnMinute );
    


    Honestly, i'm sorry i'm just a bit confused here.
  4. In Topic: A little help with my assignment

    Posted 29 Sep 2014

    Ahh, yes i found it! Ok I've made the necessary adjustments. And again sadly, i'm not all that familiar with arrays. I'll be learning about it in the later weeks of the semester though.

    #include <stdio.h>
    
    int returnDayEqualrentDayMinutes ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute );
    int returnDayEqualrentDayHours ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth );
    int returnDayGreatrentDayMinutes ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute );
    int returnDayGreatrentDayHours ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth );
    int returnDayLessrentDayMinutes ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth );
    int returnDayLessrentDayHours ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth );
    int isLeapYear ( int rentYear );
    int isRentTimeValid ( int rentHour, int rentMinute );
    int isReturnTimeValid ( int returnHour, int returnMinute );
    int isRentDateValid ( int rentMonth, int rentDay, int rentYear );
    int isReturnDateValid ( int returnMonth, int returnDay, int returnYear, int rentYear );
    int returnDateGreatRentDateCheck ( int rentMonth, int rentDay, int rentYear, int returnMonth, int returnDay, int returnYear, int currentMonth, int previousMonth, int rentHour, int rentMinute, int returnHour, int returnMinute );
    
    int main()
    {
        int invalid = 0;
        int quit = 1;
        while ( quit == 1) {
    
            int rentHourT = 0, rentMinuteT = 0;
            int leapYear = 1;
    
            printf("\nBig Bike Company Bike Rental System\n");
            printf("===================================\n");
    
            int rentMonth, rentDay, rentYear;
            printf("Enter the date the bike was rented out [mm/dd/yyyy] - ");
            scanf("%d/%d/%d", &rentMonth, &rentDay, &rentYear);
    
            int rentHour, rentMinute;
            printf("Enter the time the bike was rented out [hh:mm] -  ");
            scanf("%d:%d",  &rentHour, &rentMinute);
    
            int returnMonth, returnDay, returnYear;
            printf("\nEnter the date the bike was returned [mm/dd/yyyy] - ");
            scanf("%d/%d/%d", &returnMonth, &returnDay, &returnYear);
    
            int returnHour, returnMinute;
            printf("Enter the time the bike was returned [hh:mm] - ");
            scanf("%d:%d", &returnHour, &returnMinute);
    
            if ( isRentDateValid ( rentMonth, rentDay, rentYear ) == 1 )
                invalid = 1;
            else
                invalid = 0;
    
            if ( isReturnDateValid ( returnMonth, returnDay, returnYear, rentYear ) == 1 )
                invalid = 1;
            else
                invalid = 0;
    
            if ( isRentTimeValid ( rentHour, rentMinute ) == 1 )
                invalid = 1;
            else
                invalid = 0;
    
            if ( isReturnTimeValid ( returnHour, returnMinute ) == 1 )
                invalid = 1;
            else
                invalid = 0;
    
            if (returnMonth == 1){
    
                int currentMonth = 31;
                int previousMonth = 31;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 2){
    
                int currentMonth;
                int previousMonth = 31;
                leapYear = isLeapYear ( rentYear );
    
                if ( leapYear == 1)
                    currentMonth = 29;
                else
                    currentMonth = 28;
    
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 3){
    
                int currentMonth = 31;
                leapYear = isLeapYear ( rentYear );
    
                if ( leapYear == 1 ) {
    
                    int previousMonth = 29;
                    if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                        invalid = 1;
                    else
                        invalid = 0;
    
                    if ( returnDay == rentDay ) {
    
                        rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                        rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                    } else if ( returnDay > rentDay){
    
                        rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                        rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                    } else {
    
                        rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                        rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                    }
    
                } else {
    
                    int previousMonth = 28;
                    if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                        invalid = 1;
                    else
                        invalid = 0;
    
                    if ( returnDay == rentDay ) {
    
                        rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                        rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                    } else if ( returnDay > rentDay){
    
                        rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                        rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                    } else {
    
                        rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                        rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                    }
                }
    
            } else if ( returnMonth == 4){
    
                int currentMonth = 30;
                int previousMonth = 31;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 5){
    
                int currentMonth = 31;
                int previousMonth = 30;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 6){
    
                int currentMonth = 30;
                int previousMonth = 31;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 7){
    
                int currentMonth = 31;
                int previousMonth = 30;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 8){
    
                int currentMonth = 31;
                int previousMonth = 31;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 9){
    
                int currentMonth = 30;
                int previousMonth = 31;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 10){
    
                int currentMonth = 31;
                int previousMonth = 30;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 11){
    
                int currentMonth = 30;
                int previousMonth = 31;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
    
            } else if ( returnMonth == 12){
    
                int currentMonth = 31;
                int previousMonth = 30;
                if ( returnDateGreatRentDateCheck ( rentMonth, rentDay, rentYear, returnMonth, returnDay, returnYear, currentMonth, previousMonth, rentHour, rentMinute, returnHour, returnMinute ) == 1 )
                    invalid = 1;
                else
                    invalid = 0;
    
                if ( returnDay == rentDay ) {
    
                    rentHourT = returnDayEqualrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayEqualrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else if ( returnDay > rentDay){
    
                    rentHourT = returnDayGreatrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayGreatrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute );
    
                } else {
    
                    rentHourT = returnDayLessrentDayHours ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
                    rentMinuteT = returnDayLessrentDayMinutes ( rentMonth, rentDay, rentYear, rentHour, rentMinute, returnMonth, returnDay, returnYear, returnHour, returnMinute, previousMonth );
    
                }
            }
    
    
            if (invalid == 1){
                rentHourT = 0;
                rentMinuteT = 0;
                printf("\n\nInvalid = %d\n\n", invalid);
            }
    
            printf("\nDuration of Rental: %d hours, %d minutes\n", rentHourT, rentMinuteT);
    
            float costOfRent = 0.0;
            if((rentHourT > 0 && rentHourT < 5 ) || (rentHourT == 5 && rentMinuteT == 0)){
                costOfRent = 5;
            } else if ( rentHourT == 5 && rentMinuteT > 0 ) {
                costOfRent = 12;
            } else if ( rentHourT > 5 && rentHourT < 24) {
                costOfRent = 12;
            } else {
                if ( rentMinuteT > 0 )
                    rentHourT = rentHourT+1;
                if ( rentHourT == 1 )
                    costOfRent = 5;
                else
                    costOfRent = 12+((rentHourT-24)*0.5);
            }
    
            if ( invalid == 1) {
                costOfRent = 0;
            }
    
            printf("Cost of Rental: %.2f\n", costOfRent);
            printf("\nWould you like to assess another client? \nEnter (1) for YES or (0) for no. Selection (1) or (0) : ");
            scanf("%d", &quit);
            printf("\n");
        }
    
        printf("\n\t\tHave a Nice Day!\n\n");
        return 0;
    }
    
    int returnDayEqualrentDayMinutes ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute ){
    
        int rentMinuteT = 0;
        int rentHourT = 0;
    
        rentMinuteT = (0-rentMinute)+60+returnMinute;
        if ( rentMinuteT >= 60 ) {
            rentMinuteT = rentMinuteT-60;
            rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
        } else if ( rentHourT > 23) {
            int hConvert = rentHourT - 23;
            rentHourT = hConvert - 1;
        } else {
            rentHourT = ((0-rentHour)+returnHour)+23;
        }
    
        if(rentMinute > returnMinute ) {
            if ( returnMinute == 0 ) {
                rentMinuteT = (rentMinute-60)*-1;
                rentHourT = (returnHour-rentHour)-1;
            } else if (returnHour - rentHour == 1) {
                rentHourT = 0;
                rentMinuteT = (returnMinute-rentMinute)+60;
            } else {
                rentMinuteT = (60-rentMinute)+returnMinute;
                rentHourT = (returnHour-rentHour)-1;
            }
        } else if ( rentMinute < returnMinute ) {
            if ( rentMinute == 0 ) {
                rentMinuteT = rentMinute+returnMinute;
                rentHourT = returnHour-rentHour;
            } else if ( rentMinuteT >= 60 ) {
                rentMinuteT = rentMinuteT-60;
                rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
            } else if (rentMinute < returnMinute && rentMinute == 0) {
                rentMinuteT = (returnMinute-60)*-1;
            } else {
                rentMinuteT = (rentMinute - returnMinute)*-1;
                rentHourT = returnHour-rentHour;
            }
        } else {
            rentMinuteT = 0;
            rentHourT = returnHour-rentHour;
        }
        return rentMinuteT;
    }
    
    int returnDayEqualrentDayHours ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth ){
    
        int rentMinuteT = 0;
        int rentHourT = 0;
    
        rentMinuteT = (0-rentMinute)+60+returnMinute;
        if ( rentMinuteT >= 60 ) {
             rentMinuteT = rentMinuteT-60;
             rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
        } else if ( rentHourT > 23) {
                int hConvert = rentHourT - 23;
                rentHourT = hConvert - 1;
        } else {
            rentHourT = ((0-rentHour)+returnHour)+23;
        }
    
        if(rentMinute > returnMinute ) {
            if ( returnMinute == 0 ) {
                rentMinuteT = (rentMinute-60)*-1;
                rentHourT = (returnHour-rentHour)-1;
            } else if (returnHour - rentHour == 1) {
                rentHourT = 0;
                rentMinuteT = (returnMinute-rentMinute)+60;
            } else {
                rentMinuteT = (60-rentMinute)+returnMinute;
                rentHourT = (returnHour-rentHour)-1;
            }
        } else if ( rentMinute < returnMinute ) {
            if ( rentMinute == 0 ) {
                rentMinuteT = rentMinute+returnMinute;
                rentHourT = returnHour-rentHour;
            } else if ( rentMinuteT >= 60 ) {
                rentMinuteT = rentMinuteT-60;
                rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
            } else if (rentMinute < returnMinute && rentMinute == 0) {
                rentMinuteT = (returnMinute-60)*-1;
            } else {
                rentMinuteT = (rentMinute - returnMinute)*-1;
                rentHourT = returnHour-rentHour;
            }
        } else {
            rentMinuteT = 0;
        }
    
        if ( (rentDay == returnDay ) && ( rentYear == returnYear) && ( returnMonth > rentMonth ) ) {
            rentHourT = ((0 - rentHour)+24+returnHour)+(((previousMonth-1)-rentDay)*24)+(returnDay*24);
        }
    
        return rentHourT;
    }
    
    int returnDayGreatrentDayMinutes ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute ){
    
        int rentMinuteT = 0;
        int rentHourT = 0;
    
        rentMinuteT = (0-rentMinute)+60+returnMinute;
        if ( rentMinuteT >= 60 ) {
             rentMinuteT = rentMinuteT-60;
             rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
        } else if ( rentHourT > 23) {
                int hConvert = rentHourT - 23;
                rentHourT = hConvert - 1;
        } else {
            rentHourT = ((0-rentHour)+returnHour)+23;
        }
    
        int dayloop = returnDay-rentDay;
        while( dayloop > 1 ) {
            rentHourT = rentHourT+24;
            dayloop--;
        }
        return rentMinuteT;
    }
    
    int returnDayGreatrentDayHours ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth ){
    
        int rentMinuteT = 0;
        int rentHourT = 0;
    
        rentMinuteT = (0-rentMinute)+60+returnMinute;
        if ( rentMinuteT >= 60 ) {
            rentMinuteT = rentMinuteT-60;
            rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
        } else if ( rentHourT > 23) {
            int hConvert = rentHourT - 23;
            rentHourT = hConvert - 1;
        } else {
            rentHourT = ((0-rentHour)+returnHour)+23;
        }
    
        int dayloop = returnDay-rentDay;
        while( dayloop > 1 ) {
            rentHourT = rentHourT+24;
            dayloop--;
        }
    
        if ( (returnMonth > rentMonth) && (returnDay > rentDay) && (rentYear == returnYear)) {
            rentHourT = (((0 - rentHour)+24+returnHour)+( ((previousMonth-1)-rentDay)*24))+(returnDay*24);
        }
    
        return rentHourT;
    }
    
    int returnDayLessrentDayMinutes ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth ){
    
        int rentMinuteT = 0;
        int rentHourT = 0;
    
        rentMinuteT = (0-rentMinute)+60+returnMinute;
        if ( rentMinuteT >= 60 ) {
            rentMinuteT = rentMinuteT-60;
            rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
        } else if ( rentHourT > 23) {
            int hConvert = rentHourT - 23;
            rentHourT = hConvert - 1;
        } else {
            rentHourT = ((0-rentHour)+returnHour)+23;
        }
    
        int dayloop = (returnDay-rentDay)+previousMonth;
        while( dayloop > 1 ) {
            rentHourT = rentHourT+24;
            dayloop--;
        }
        return rentMinuteT;
    }
    
    int returnDayLessrentDayHours ( int rentMonth, int rentDay, int rentYear, int rentHour, int rentMinute, int returnMonth, int returnDay, int returnYear, int returnHour, int returnMinute, int previousMonth ){
    
        int rentMinuteT = 0;
        int rentHourT = 0;
    
        rentMinuteT = (0-rentMinute)+60+returnMinute;
        if ( rentMinuteT >= 60 ) {
            rentMinuteT = rentMinuteT-60;
            rentHourT = rentHourT+1+((0-rentHour)+returnHour)+23;
        } else if ( rentHourT > 23) {
            int hConvert = rentHourT - 23;
            rentHourT = hConvert - 1;
        } else {
            rentHourT = ((0-rentHour)+returnHour)+23;
        }
    
        int dayloop = (returnDay-rentDay)+previousMonth;
        while( dayloop > 1 ) {
            rentHourT = rentHourT+24;
            dayloop--;
        }
    
        if ( (returnMonth > rentMonth) && (returnDay < rentDay) && (rentYear == returnYear)) {
            rentHourT = (((((0 - rentHour)+24+returnHour)+( ((previousMonth-rentDay)-1)*24))+((returnDay)*24)));
        }
    
        return rentHourT;
    }
    
    int isLeapYear ( int rentYear ) {
    
        int leapYear;
    
        if ( (rentYear%4 == 0) && (rentYear%100 != 0) )
            leapYear = 1;
        else if ( (rentYear%4 == 0) && (rentYear%100 == 0) && (rentYear%400 == 0) )
            leapYear = 1;
        else if ( (rentYear%4 == 0) && (rentYear%100 == 0) && (rentYear%400 != 0))
            leapYear = 0;
        else
            leapYear = 0;
    
            return leapYear;
    }
    
    int isRentTimeValid ( int rentHour, int rentMinute ) {
    
        int invalid;
        if ( rentHour >= 0 && rentHour <= 23) {
            invalid = 0;
        } else {
            printf("\nInvalid rent Hour!!\n");
            invalid = 1;
        }
        if ( rentMinute >= 0 && rentMinute  <= 59) {
            invalid = 0;
        } else {
            printf("\nInvalid rent Minute!!\n");
            invalid = 1;
        }
        return invalid;
    }
    
    int isReturnTimeValid ( int returnHour, int returnMinute ) {
    
        int invalid;
        if (returnHour >= 0 && returnHour <= 23) {
            invalid = 0;
        } else {
            printf("\nInvalid return Hour!!\n");
            invalid = 1;
        }
        if (returnMinute >= 0 && returnMinute <= 59) {
            invalid = 0;
        } else {
            printf("\nInvalid return Minute!!\n");
            invalid = 1;
        }
        return invalid;
    }
    
    int isRentDateValid ( int rentMonth, int rentDay, int rentYear ) {
    
        int invalid;
        if (rentMonth > 0 && rentMonth <= 12) {
            invalid = 0;
        } else {
            printf("\nInvalid rent Month!!\n");
            invalid = 1;
        }
    
        if (rentDay > 0 && rentDay <= 31 ) {
            invalid = 0;
        } else {
            printf("\nInvalid rent Day!!\n");
            invalid = 1;
        }
    
        if ( rentYear > 0 ) {
            invalid = 0;
        } else {
            printf("\nInvalid rent Year!!\n");
            invalid = 1;
        }
        return invalid;
    }
    
    int isReturnDateValid ( int returnMonth, int returnDay, int returnYear, int rentYear ) {
    
        int invalid;
        if (returnMonth > 0 && returnMonth <= 12) {
            invalid = 0;
        } else {
            printf("\nInvalid return Month!!\n");
            invalid = 1;
        }
    
        if (returnDay > 0 && returnDay <= 31) {
            invalid = 0;
        } else {
            printf("\nInvalid returnDay!!\n");
            invalid = 1;
        }
    
        if ( returnYear >= rentYear ) {
            invalid = 0;
        } else {
            printf("\nInvalid return Year!!\n");
            invalid = 1;
        }
        return invalid;
    }
    
    int returnDateGreatRentDateCheck ( int rentMonth, int rentDay, int rentYear, int returnMonth, int returnDay, int returnYear, int currentMonth, int previousMonth, int rentHour, int rentMinute, int returnHour, int returnMinute ) {
    
        int invalid;
        if ( ((rentMonth == returnMonth) && ( rentYear == returnYear )) && rentDay > returnDay ) {
            printf("\nInvalid return Day!!\n");
            invalid = 1;
        }
        if ( (rentYear == returnYear) && rentMonth > returnMonth ) {
            printf("\nInvalid return Month!!\n");
            invalid = 1;
        }
        if( rentDay > currentMonth || returnDay > currentMonth) {
            printf("\nInvalid rent Day or return Day\n");
            invalid = 1;
        }
        if ( (rentDay == returnDay) && ( rentMonth == returnMonth) && ( rentYear == returnYear) ) {
            if ( returnHour < rentHour ) {
                printf("\nInvalid return Hour!!\n");
                invalid = 1;
            }
        }
        if ( (rentDay == returnDay) && ( rentMonth == returnMonth) && ( rentYear == returnYear) && ( rentHour == returnHour) ) {
            if ( returnMinute < rentMinute ) {
                printf("\nInvalid return Minute!!\n");
                invalid = 1;
            }
        }
    
        if ( returnDay < rentDay ) {
            if( ((rentDay < currentMonth) > previousMonth) || returnDay > currentMonth){
                printf("\nInvalid return Day!!\n");
                invalid = 1;
            }
    
            if ( rentDay > previousMonth ) {
                printf("\nInvalid rent Day!!\n");
                invalid = 1;
            }
        }
        if( rentYear > returnYear )
            invalid = 1;
    
        if (((( rentDay == returnDay ) && ( rentMonth == returnMonth) && ( rentYear == returnYear) && ( rentHour == returnHour) && ( rentMinute == returnMinute))))
            invalid = 1;
        return invalid;
    }
    
    
    


    Thank you once again :)

    One of the hardest things to do for me though, is identifying how much functions i'll need and what functions i'll need for said program.
  5. In Topic: A little help with my assignment

    Posted 28 Sep 2014

    View PostGamma Ray, on 28 September 2014 - 09:03 PM, said:

    Great. But maybe you should check only one date and one time at once.

    I'm not sure how I'll do that. Isn't that what I'm doing now?

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

Twigz has no profile comments yet. Why not say hello?