Can Someone help me regarding my C++ Assignments? I'll list the questions below:

ASSIGNMENT 1

Assume the array in the following table represents the monthly rental price of six resort cabins over a five-year period.

YEAR
2005 2006 2007 2008 2009

1 200 210 225 300 235
2 250 465 343 255 344
CABIN 3 233 333 453 268 365
4 200 325 400 333 222
5 200 160 642 674 358

Write a program that employs functions to perform the following tasks:

i. Fill a two-dimensional array with the above table
ii. Compute the total rental income for each cabin by year and store the yearly totals in a second array.

ASSIGNMENT 2

An International Standard Book Number (ISBN) is a code of 10 characters separated by dashes such as 0-8065-0959-7.

An ISBN consists of four parts : a group code, a publisher code, a code that uniquely identifies the book among those published by the particular publisher, and a check character.

For the ISBN 0-8065-0959-7, the group code is 0, which identifies the book as one from and English-speaking country.

The publisher code 8065 identifies the book as one published by Citadel Press. The code 0959 uniquely identifies the book among those published by Citadel Press ( Brode: Woody Allen : His Films and Career, in this case ).

The check character is computed as follows: First compute the sum of the first digit plus two times the second digit plus three times the third digit,……, plus nine times the ninth digit. The last character is the remainder when the sum is divided by 11. If the remainder is 10, the last character is X which is considered as invalid ISBN number. For example, the sum for the ISBN 0-8065-0959-7 is 0 + 2*8 + 3*0 + 4*6 + 5*5 + 6*0 + 7*9 + 8*5 + 9*9 = 249. The remainder when 249 is divided by 11 is 7, the last character in the ISBN. The check character is use to validate an ISBN.

Write a program that uses one function that receive one parameter s that is an array of characters. The function returns 1 (true) if the array represents a valid ISBN and 0 (false) otherwise.

ASSIGNMENT 3

Write a modular program (function) for problem given below.

This program will let you enter the initial balance for the month, followed by a series of transactions. There is no limit on the number of transactions the program can process. A transaction takes the form of two input values: a single letter, followed by a float number. If the letter is:

C, then the number is the amount for a check (withdrawal)
D, then the number is the amount for a deposit
E, this is a sentinel value to signal the end of input

For each transaction entered, the program will echo-print the transaction data, the current balance for the account ( not including deductions for service charges ), the service charge for the transaction, and the total accumulated service charges for all transactions. After the end sentinel is processed, the program will print the current balance, total service charges, and the closing balance (balance after deducting service charges ).

Service charges are:
• Check fee : $0.15 for each check (withdrawal )
• Deposit fee : $0.10 for each deposit
• Low balance fee : if the balance drops below $500.00 at any point during the month, a service charge of $5.00 is assessed for the month ( one time only ).
• If the balance drops below $50.00, the program prints a warning message, but no fee is charged.
• Overdrawn balance fee : if the balance becomes negative, an additional service charge of $10.00 must be assessed for each check until the balance becomes positive again.

ASSIGNMENT 4

ASSIGNMENT 6 (ARRAYS)


Write a program to assign passengers seats in an airplane. Assume a small airplane with seat numbering as follows :

1 A B C D
2 A B C D
3 A B C D
4 A B C D
5 A B C D
6 A B C D
7 A B C D

The program should display the seat pattern, with an 'X' marking the seat already assigned. For example, after seats 1A, 2B, and 4C are taken, the display should look like :

1 X B C D
2 A X C D
3 A B C D
4 A B X D
5 A B C D
6 A B C D
7 A B C D

After displaying the seats available, the program prompts for the seat desired, the user types in a seat, then the display of available seats is updated. This continues until all seats are filled or until the user signals that the program should end. If the user types in a seat that is already assigned, the program should say that the seat is occupied and ask for another choice.

What have you done so far?
Remember we have to help you get somewhere, but you must have something :)

commented: <tealc>Indeed</tealc> +36

very cute.

What have you done so far?
Remember we have to help you get somewhere, but you must have something :)

Well for assignment 1, I have done the following. The problem is about displaying the output. It's some sort of messy, have no idea on how sorting it anymore.

#include <iostream.h>
main()
{
    int cabin[5][5]={{200,210,225,300,235},
    {250,465,343,255,344},
    {233,333,453,268,365},
    {200,325,400,333,222},
    {200,160,642,674,358}};

    char choose;

    int total[5][5];

    int i,j,m,n;


    for(i=0;i<5;i++)
    {
        for(j=0;j<5;j++)

            cout<<cabin[i][j]<<"    ";
            cout<<"\n";

    }

    cout<<"\nPress C (Capital C) to Calculate The Yearly Income For All Cabin ";
    cin>>choose;

    if (choose == 'C')
    {
        for(i=0;i<5;i++)
        {
            for (j=0;j<5;j++)
            {
                        total[i][j]= cabin[i][j]*12;
                        cout<<total[i][j]<<"    ";
                        cout<<"\n";

            }

        }
        for(i=0;i<5;i++)
        {
            for (j=0;j<5;j++)
            {
                        cout<<total[i][j]<<"    ";
                        cout<<"\n";
                }
            }
        }



    }







    else 
        cout<<"Can't You Read? Capital C Only!!!!"<<endl;



    return 0;
}

For Assignment 2, I'm still making it. >.<

For Assignment 3, I have done the following. Yes, the program is not working as I have no idea where and what is the mistake. >.<

#include <iostream.h>

#define CF 0.15
#define DF 0.10
#define LB 5.00
#define OD 10.00


float result(char transaction, float balance, float amount);

void main ()

{

    float b, a, i;
    char t;

    cout<<"\nWelcome To Mike's Banking";
    cout<<"\nChoose C for withdrawal";
    cout<<"\nChose D for deposit";
    cout<<"\nChoose E for end of input";

    cout<<"\n\nWhat's Your Current Balance";
    cin>>b;
    cout<<"\nWhat Transaction You Want To Do: ";
    for (i=1; i>0; i++)
    {
    cin>>t;
    }
    cout<<"\nWhat's The Amount You Want To Involve: ";
    cin>>a;

    if (t == 'C')
    {
        cout<<"\nYour Current Account Balance Is: "<<b;
        cout<<"\nYou Have Chosen To Withdraw Money";
        cout<<"\nYour Check Fee Is $0.15";
        for (i=0; i<1; i++);
        {
            if (b < 500)
                cout<<"There's A Low Balance Fee $For 500.00";
        }
            for (i=0; i<1; i++);
        {
            if (b < 50)
                cout<<"Your Balance Is Below 50 Dollars";
        }

    }


    else if (t == 'D')
    {
        cout<<"\nYour Current Account Balance Is: "<<b;
        cout<<"\nYou Have Chosen To Deposit Money";
        cout<<"\nYour Deposit Fee Is $0.10";
        for (i=0; i<1; i++);
        {
            if (b < 0)
                cout<<"There's An Overdrawn balance fee for $10.00";
        }
        for (i=0; i<1; i++);
        {
            if (b < 50)
                cout<<"Your Balance Is Below 50 Dollars";
        }
    }

    else if (t == 'E')
    {
        cout<<"\nYou Have Chosen to end the transaction";
        cout<<"\nYour Initial Balance Was: "<<b;
        cout<<"\nYour Total Service Charges Is: ";
        cout<<"\nYour End Balance Is: "<<result;
    }

    else
        cout<<"Choose A Choice man!";


}

float result(char transaction, float balance, float amount)
{
    char t;
    float i, b, a;
    if (t == 'C')
    {
        for (i=0;i<1;i++);
        {
            if ( b < 0 && b < 500)
            {
                result = b + a - 0.15 - 5;
                return result;
            }
            else if ( b < 500)
            {
                result = b + a - 5;
                return result;
            }
            else if (b < 0)
            {
                result = b + a - 0.15;
                return result;
            }
        }
    }

    if (t == 'D')
    {
        for (i=0;i<1;i++);
        {
            if ( b < 0 && b < 500)
            {
                result = b + a - 0.10 - 5;
                return;
            }
            else if ( b < 500)
            {
                result = b + a - 5;
                return;
            }
            else if (b < 0)
            {
                result = b + a - 0.10;
                return;
            }
        }
    }


}

For Assignment 4, I have only done the first output. I have no idea on doing the calculation and the final output. >.<

#include <iostream.h>
main()
{
    char seat[7][5]= {{'1','A','B','C','D'}, {'3','A','B','C','D'}, {'3','A','B','C','D'}, {'4','A','B','C','D'}, {'5','A','B','C','D'}, {'6','A','B','C','D'}, {'7','A','B','C','D'}};

    int i,j, sr,
    char sc;


    for(i=0;i<7;i++)
    {
        for(j=0;j<5;j++)

            cout<<seat[i][j]<<"    ";
            cout<<"\n";

    }
    cout<<"\nPlease Pick The Seat's Number";
    cin>>sr;
    cout<<"\nPlease Pick The Seat's Place";
    cin>>sc;
    return 0;
}

Any kind of help on any kind of assignments are really appreciated..:)

Code tags. Use them.

Well for assignment 1, I have done the following. The problem is about displaying the output. It's some sort of messy, have no idea on how sorting it anymore.

#include <iostream.h>
main()
{
    int cabin[5][5]={{200,210,225,300,235},
    {250,465,343,255,344},
    {233,333,453,268,365},
    {200,325,400,333,222},
    {200,160,642,674,358}};

    char choose;

    int total[5][5];

    int i,j,m,n;


    for(i=0;i<5;i++)
    {
        for(j=0;j<5;j++)

            cout<<cabin[i][j]<<"    ";
            cout<<"\n";

    }

    cout<<"\nPress C (Capital C) to Calculate The Yearly Income For All Cabin ";
    cin>>choose;

    if (choose == 'C')
    {
        for(i=0;i<5;i++)
        {
            for (j=0;j<5;j++)
            {
                        total[i][j]= cabin[i][j]*12;
                        cout<<total[i][j]<<"    ";
                        cout<<"\n";

            }

        }
        for(i=0;i<5;i++)
        {
            for (j=0;j<5;j++)
            {
                        cout<<total[i][j]<<"    ";
                        cout<<"\n";
                }
            }
        }



    }







    else 
        cout<<"Can't You Read? Capital C Only!!!!"<<endl;



    return 0;
}

For Assignment 2, I'm still making it. >.<

For Assignment 3, I have done the following. Yes, the program is not working as I have no idea where and what is the mistake. >.<

#include <iostream.h>

#define CF 0.15
#define DF 0.10
#define LB 5.00
#define OD 10.00


float result(char transaction, float balance, float amount);

void main ()

{

    float b, a, i;
    char t;

    cout<<"\nWelcome To Mike's Banking";
    cout<<"\nChoose C for withdrawal";
    cout<<"\nChose D for deposit";
    cout<<"\nChoose E for end of input";

    cout<<"\n\nWhat's Your Current Balance";
    cin>>b;
    cout<<"\nWhat Transaction You Want To Do: ";
    for (i=1; i>0; i++)
    {
    cin>>t;
    }
    cout<<"\nWhat's The Amount You Want To Involve: ";
    cin>>a;

    if (t == 'C')
    {
        cout<<"\nYour Current Account Balance Is: "<<b;
        cout<<"\nYou Have Chosen To Withdraw Money";
        cout<<"\nYour Check Fee Is $0.15";
        for (i=0; i<1; i++);
        {
            if (b < 500)
                cout<<"There's A Low Balance Fee $For 500.00";
        }
            for (i=0; i<1; i++);
        {
            if (b < 50)
                cout<<"Your Balance Is Below 50 Dollars";
        }

    }


    else if (t == 'D')
    {
        cout<<"\nYour Current Account Balance Is: "<<b;
        cout<<"\nYou Have Chosen To Deposit Money";
        cout<<"\nYour Deposit Fee Is $0.10";
        for (i=0; i<1; i++);
        {
            if (b < 0)
                cout<<"There's An Overdrawn balance fee for $10.00";
        }
        for (i=0; i<1; i++);
        {
            if (b < 50)
                cout<<"Your Balance Is Below 50 Dollars";
        }
    }

    else if (t == 'E')
    {
        cout<<"\nYou Have Chosen to end the transaction";
        cout<<"\nYour Initial Balance Was: "<<b;
        cout<<"\nYour Total Service Charges Is: ";
        cout<<"\nYour End Balance Is: "<<result;
    }

    else
        cout<<"Choose A Choice man!";


}

float result(char transaction, float balance, float amount)
{
    char t;
    float i, b, a;
    if (t == 'C')
    {
        for (i=0;i<1;i++);
        {
            if ( b < 0 && b < 500)
            {
                result = b + a - 0.15 - 5;
                return result;
            }
            else if ( b < 500)
            {
                result = b + a - 5;
                return result;
            }
            else if (b < 0)
            {
                result = b + a - 0.15;
                return result;
            }
        }
    }

    if (t == 'D')
    {
        for (i=0;i<1;i++);
        {
            if ( b < 0 && b < 500)
            {
                result = b + a - 0.10 - 5;
                return;
            }
            else if ( b < 500)
            {
                result = b + a - 5;
                return;
            }
            else if (b < 0)
            {
                result = b + a - 0.10;
                return;
            }
        }
    }


}

For Assignment 4, I have only done the first output. I have no idea on doing the calculation and the final output. >.<

#include <iostream.h>
main()
{
    char seat[7][5]= {{'1','A','B','C','D'}, {'3','A','B','C','D'}, {'3','A','B','C','D'}, {'4','A','B','C','D'}, {'5','A','B','C','D'}, {'6','A','B','C','D'}, {'7','A','B','C','D'}};

    int i,j, sr,
    char sc;


    for(i=0;i<7;i++)
    {
        for(j=0;j<5;j++)

            cout<<seat[i][j]<<"    ";
            cout<<"\n";

    }
    cout<<"\nPlease Pick The Seat's Number";
    cin>>sr;
    cout<<"\nPlease Pick The Seat's Place";
    cin>>sc;
    return 0;
}

Any kind of help on any kind of assignments are really appreciated..:)

Assignment 4 - Line 1 should be int main (). Same with the other assignments.

Regarding your indentation, it's a bit off and therefore hard to read. If you've done so, don't mic tabs and spaces because it looks terrible on Daniweb (a tab is 8 spaces). Blocks of code should stand out. Too much or too little indentation makes it hard to read.

Finally, four different assignments should probably be four different threads.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.