Assignment 4
: Functions, Class, and Object
Practice Programs:
1. Write a PHP script to calculate the area and volume of a cylinder using a function.
Answer :
2. Write a PHP Script to display the sum and average of array elements(Using predefined functions)
Answer :
3. Write a PHP script to calculate the factorial of a number using a function.
Answer :
SET A:
1. Write a PHP script to calculate x y using a function.
Answer :
2. Write a PHP script to define a function Even Odd, which will display even and odd numbers between 1 to 50.
Answer :
3. Write a PHP script to define a function Maximum, which will accept 3 numbers as parameters and returns a maximum of 3 numbers.
Answer :
4. Write a PHP script to swap two numbers using a function (Use Call by value and Call by reference)
Answer :
SET B:
1. Write a PHP Script to create a class Fruit that contains data members as Name, Color and Price. Write a member function to accept and display details of Fruit.
Answer :
2. Write a PHP Script to create a class Student that contains data members as Roll_Number, Stud_Name, and Percentage. Write member functions to accept Student information.
Answer :
3. Write a PHP Script to create a class Book (Book_id, Book_name, Publication, Author, Book_price). Write a member function to accept and display Book details.
Answer :
SET C:
1. Write a PHP script to define a function “DisplayDay”, which will display the day of the current date.
Answer :
2. Write a PHP script to perform arithmetic operations on two numbers. Write a PHP function to display the result. (Use the concept of function and default parameters)
Answer :
Assignment 4 : Functions, Class, and Object
Reviewed by technical_saurabh
on
March 18, 2021
Rating:
No comments:
Post a Comment