Find the answer to your Linux question:
Results 1 to 3 of 3

Thread: Script Help

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Exclamation Script Help


    I cannot figure out this scripting and am desperate for help and was hoping someone can find it in their heart to help me answer these questions.

    1. Declare a function that is called Compute_Avg. The function returns a float data, receives an integer parameter named “num”, and a float parameter named “Average”.

    2. x = 2, y =1, z =3, what is the value of x, y, z after executing the following codes?
    case 0: x =2; y =3;
    case 1: x =3; break;
    default: x=3; y=2 ;

    3. Find any errors in the following function declarations.
    a. int sun(int x, y);
    b. int sun(int x, int y)
    c. void sun(void, void) ;
    d void sun(x int, y float);

    4. What is the output of the code corresponding to the following pseudocode?
    X = -5;
    if (X > 0)
    if (!((X=0) && (X<0)))

    void print_message(void);
    int main()
    print_message( );
    printf(“This is a new message.\n”);
    print_message( );
    print_message( );
    printf(“The end.\n”);
    return 0;
    void print_message( )
    printf(“Hello !\n”);

    5. If num=5, determine whether each of the following expressions is true or false.
    a. (num*num)>=(2*num)
    b. (3*num-2)<=6

    6. A home mortgage authority requires a deposit on a home loan according to the following schedule:
    Loan$ Deposit
    Less than $25000 6% of loan value
    $25000-$49000 $1000+10% of loan
    $49000-$100000 $2000+25% of loan
    Loans in excess of $100000 are not allowed. Write a program that will read a loan amount and compute and print the required deposit.

    7 Write a program that inputs one number, then display “yes” if num = 1, display “no” if num =2, displays “maybe” if num = 3, display “Error message” if num is not 1,2 or 3. Implement this program by a Switch statement.

    8. Write a function float Average(int, int, int, int) that finds the average of four numbers, and then write a main program that inputs four numbers from the user. You need to call the function and display the mean of the four numbers in the main.

    The cost of renting a tool is $20 for the first day, $10 per day for the next 3 days and $8 per day thereafter. If the input is the number of days the tool was rented, compute the cost of renting the tool.

  2. #2
    I am sorry for bothering anyone for this help, but i've been sick with the flu and have fallen behind with my work. So i'd be greatful if someone can please help me with this and the shell scripting post I answered.



  3. #3
    Administrator MikeTbob's Avatar
    Join Date
    Apr 2006
    This looks like homework, which is against forum rules.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

    I'd rather be lost at the lake than found at home.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts