Code a C++ function Circle_Circum() that takes one double argument that represents the
radius of a circle. The function should return the circumference of the circle.
Construct function prototypes that match the following descriptions:
i) ab () takes no arguments and has no return value.
ii) start() takes an int argument and returns a float.
iii) mk() takes two type double arguments and returns a double.
iv) func6() returns an int and takes three arguments. The first and third arguments are of
type double. The second argument is of type int.
v) func4() returns a char and takes one argument that is also of type char.
Pyramid
Given an integer N, write a program to print a pyramid of N rows as shown below.
Input
The first line of input is an integer N.
Explanation
In the example, the number of rows in the pyramid is
5.So, the output should be
. . . . 0 . . . .
. . . 0 0 0 . . .
. . 0 0 0 0 0 . .
. 0 0 0 0 0 0 0 .
0 0 0 0 0 0 0 0 0
Sample Input 1
5
Sample Output 1
. . . . 0 . . . .
. . . 0 0 0 . . .
. . 0 0 0 0 0 . .
. 0 0 0 0 0 0 0 .
0 0 0 0 0 0 0 0 0
Sample Input 2
6
Sample Output 2
. . . . . 0 . . . . .
. . . . 0 0 0 . . . .
. . . 0 0 0 0 0 . . .
. . 0 0 0 0 0 0 0 . .
. 0 0 0 0 0 0 0 0 0 .
0 0 0 0 0 0 0 0 0 0 0
Digit 9
You are given N as input. Write a program to print the pattern of 2*N - 1 rows using an asterisk(*) as shown below.
Note: There is a space after each asterisk * character.
Input
The first line of input is an integer N.
Explanation
In the given example,
N = 4.So, the output should be
* * * *
* *
* *
* * * *
*
*
* * * *
Sample Input 1
4
Sample Output 1
* * * *
* *
* *
* * * *
*
*
* * * *
Sample Input 2
5
Sample Output 2
* * * * *
* *
* *
* *
* * * * *
*
*
*
* * * * *
Shaded Diamond
Given an integer value N as input, write a program to print a shaded diamond of 2*N -1 rows using an asterisk(*) character as shown below.
Note: There is a space after each asterisk (*) character.
Input
The first line of input is an integer N.
Explanation
In the given example
N = 5. Therefore, the output should be
*
* *
* * *
* * * *
* * * * *
* *
* *
* *
*
Sample Input 1
6
Sample Output 1
*
* *
* * *
* * * *
* * * * *
* * * * * *
* *
* *
* *
* *
*
Sample Input 2
5
Sample Output 2
*
* *
* * *
* * * *
* * * * *
* *
* *
* *
*
Write a program that calculates GPA
Arrays in main function
1. A two dimensional array Grades[Number_of_students][Number_of_subjects] that stores the grades (0 ~ 100) of 6 students for 4 subjects.
2. A one dimensional array Credit_hours[Number_subjects]
3. A two dimensional array Grade_points.
Grade_points [Number_of_students][Number_of_subjects] that will stores the grade points of each subject for 6 students.
4. A one dimensional array GPA[Number_of_students] that stores the GPA of each student
Write the following Functions
a. A function Enter_Grades() that takes the two dimensional Grades array.
b. A function Enter_credit_hours that takes the array Credit_hours.
c. A function Display_grades
d. A function Calculate_ Grade_points that takes two arrays Grades and Grade_points.
e. A function Calculate_GPA that takes three arrays Credit_hours, GPA and
GPA=(GP1*CH1 + GP2*CH2 + GP3*CH3 + GP4*CH4)/(CH1 + CH2 + CH3 + CH4)
generate random integers in the range [ LOW = 1, HIGH = 10000 ] and to store them in a vector < int > of size VEC_SIZE = 250. Then, sort the contents of the vector (in ascending order) and display it on stdout. To sort the contents of a vector, use the sort ( ) function in the STL. In addition to the main ( ) routine, implement the following subroutines in your program: • void genRndNums ( vector < int >& v ) : This routine generates VEC_SIZE integers and puts them in vector v. Initializes the random number generator (RNG) by calling the function srand ( SEED ) with the seed value SEED = 1 and generates random integers by calling the function rand ( ). • void printVec ( const vector < int >& v ) : This routine displays the contents of vector v on stdout, printing exactly NO_ITEMS = 12 numbers on a single line, except perhaps the last line. The sorted numbers need to be properly aligned on the output. For each printed number, allocate ITEM_W = 5 spaces on stdout.
Design a program using Java NetBeans (Console application). With the following enum class: public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } Create a second class called enumDayMood with a void method call telDayMood (). This method contain a switch case as follows: switch (day) { case MONDAY: JOptionPane.showMessageDialog (frame, "Mondays are bad."); break; case FRIDAY: JOptionPane.showMessageDialog (frame, "Fridays are better."); break; case SATURDAY: case SUNDAY: JOptionPane.showMessageDialog (frame, "Weekends are best."); break; default: JOptionPane.showMessageDialog (frame, “Midweek days are so-so."); break; } Create a method that will ask the user to enter a day of a week and the program should tell the mood of the day. If the user enter a wrong value the program should exit with 0.
Prompt user to input distance in Kilometers and display it in meters.