0% found this document useful (0 votes)
7 views1 page

Valid Java Function Prototypes Guide

The document provides an overview of function prototypes and headers in Java programming. It lists various problems that require the creation of valid function prototypes to perform specific tasks, such as calculating areas, checking leap years, and determining the largest of two values. Each problem outlines the expected inputs and outputs for the functions to be defined.

Uploaded by

vidhimotwani7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Valid Java Function Prototypes Guide

The document provides an overview of function prototypes and headers in Java programming. It lists various problems that require the creation of valid function prototypes to perform specific tasks, such as calculating areas, checking leap years, and determining the largest of two values. Each problem outlines the expected inputs and outputs for the functions to be defined.

Uploaded by

vidhimotwani7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Excellence Computers Your Gateway to Java From Balaji_Sir 8975985500

Concept: Function Prototype / Function Header


The first line of the function definition is called as function header/ prototype.
Function prototype contains access specifier (generally public), functions return data type, function name
followed by pair of parenthesis.
Within parenthesis there will be zero or more formal parameters.
Number of formal parameters will depend on number of inputs required to solve given problem.

Write valid function prototype to solve following problems.


1. Function to accept radius of circle calculates and returns area of circle.
2. Function to accept radius of circle calculates area of circle and prints it.
3. Function to accept radius of circle and returns diameter of that circle.
4. Function to accept length and breadth of the rectangle prints its perimeter.
5. Function to accept amount of Indian rupees and returns its equivalent
amount in American dollars.
6. Function to accept two integer numbers and returns biggest of them.
7. Function to accept two alphabets and returns biggest of them.
8. Function to accept two names and returns biggest of them.
9. Function to accept any one number and returns its sum of digits.
10. Function to accept one integer number and returns its factorial.
11. Function to accept marks in three subjects and returns their average.
12. Function to accept any one integer numbers and return sum of all natural
numbers from 1 up to given number.

Note: In following problems check means if answer is yes then return true
otherwise false.

13. Function to accept year and check whether it is leap year or not.
14. Function to accept any one integer number and check whether it’s even or
odd number.
15. Function to accept any one integer numbers and return sum of all natural
numbers from 1 up to given number.
16. Function to accept any one alphabet and check whether it’s uppercase or
lowercase alphabet.

Excellence Computers Your Gateway to Java From Balaji_Sir 8975985500

You might also like