Declare an Array of 20 integers. Initialize the array with random integers using the rand() function and print the following: a. number of positive numbers b. number of negative numbers c. number of odd numbers d. number of even numbers e. number of 0
Write a C++ program that would print the information (name, year of joining, salary, address) of three employees by creating a class named 'Employee'. The output should be as follows: Name Year of joining Address Robert 1994 64C- WallsStreat Sam 2000 68D- WallsStreat John 1999 26B- WallsStreat
Write a C++ Program in which Create a class called 'Matrix' containing constructor that initializes the number of rows and the number of columns of a new Matrix object. The Matrix class has the following information: 1 - number of rows of matrix 2 - number of columns of matrix 3 - elements of matrix (You can use 2D vector) The Matrix class has functions for each of the following: 1 - get the number of rows 2 - get the number of columns 3 - set the elements of the matrix at a given position (i,j) 4 - adding two matrices. 5 - multiplying the two matrices You can assume that the dimensions are correct for the multiplication and addition
Write a C++ program by creating an 'Employee' class having the following functions and print the
final salary.
1 - 'getInfo()' which takes the salary, number of hours of work per day of employee as
parameters
2 - 'AddSal()' which adds $10 to the salary of the employee if it is less than $500.
3 - 'AddWork()' which adds $5 to the salary of the employee if the number of hours of work per
day is more than 6 hours.
Assume that you have to submit the form
to the administrator of your organization.
People have to enter in the line from the
backside, wait for their turn and then leave
after submission and their processing from the front end. Determine the most suitable data
structure. Provide both programs:
• For array based
• Linked List based
You have to pile clothes in a box in such a
way that cloths can be added and removed
from only one end. Determine the most
suitable data structure. Provide both array
based and linked list based implementation.
Create a time class that includes integer member values for hours, minutes, and seconds. Make a member function get_time() that gets a time value from the user, and a function put_time() that displays a time in 12:59:59 format. Add error checking to the get_time() function to minimize user mistakes. This function should request hours, minutes, and seconds separately, and check each one for ios error status flags and the correct range. Hours should be between 0 and 23, and minutes and seconds between 0 and 59. Don’t input these values as strings and then convert them; read them directly as integers. This implies that you won’t be able to screen out entries with superfluous decimal points, as does the ENGL_IO program in this chapter 12, but we’ll assume that’s not important. In main(), use a loop to repeatedly get a time value from the user with get_time() and then display it with put_time(), like this:
Enter hours: 11
Enter minutes: 59
Enter seconds: 59
time = 11:59:59
A hospital administrator wished to develop a regression model for predicting the degree of long-term recovery after discharge from hospital for severely injured patients. The predictor variable to be utilized is number of days of hospitalization and the dependent variable is a prognosis index for long-term recovery (with large values of the index reflecting a good prognosis). Data for 15 patients
Using conditional statement and looping statements, write a C++ program that will allow the users to select a looping statement which he/she wants to use. The program will also allow the users to enter the starting and ending number to display using the selected looping statement.
Sample Output:
Looping Statements:
1 - while loop
2 - do-while loop
3 - for loop
Enter the number of looping statement: 2
Enter Starting Number: 2
Enter Ending Number: 10
The Numbers: 2,3,4,5,6,7,8,9,10,
Write a program that reads Final Year Project (FYP) that consist of Viva score and report marks of
5 (five) students to 2-dimensional (2-D) array named student. The elements from the array
must be initialize to 0 during declaration. The overall FYP marks is measured as follows:
FYP marks=(Viva*0.5)+(Report*0.5)
The viva score and overall FYP marks must be stored in the 2-D array. Then, determine the
followings:
(i) Average of FYP marks
(ii) Highest FYP marks
(iii) Lowest FYP marks
(iv) Suppose that FYP Best Presenter Award is given to students with viva score of 80 and
above, determine the number of students that eligible to receive the award
(v) Suppose that FYP Award is given to students with overall FYP marks of 80 and above,
determine the number of students that eligible to receive the award
(vi) Suppose that pass mark for FYP is 60 and above, determine the percentage of the pass
student