write a programme that implements the following:
1- a class called shape which includes the height and the width as private attributes,
2- a derived class called rectangle which inherits the attributed from the shape and have a method called area which finds the area of the rectangle
3- a derived class called triangle which inherits the attributes from the shape and have a method called area that finds the area of the triabgle,
Using exec system call list all the files and directories of home then
store the result in “output1.txt”. Run a second command “grep” and find
the word “output1.txt” in all the text files of the home also place home
path in “PATH” environment variable while doing exec for grep. This all
will be done in one process.
Write a program that receives one command-line argument: the name
of a text file. Your program will work as follows:
Start out by creating a child process.
The child process calls exec to run cat command with command-line argument that
the parent received.
The parent process calls wait so that it blocks until the child terminates and passes
back its termination status.
If the child process terminates without error, the parent spawns another child and,
again, calls wait so that it can block until the child terminates.
The new child calls exec again, but this it runs wc command on the same
the argument that the parent received from the command line.
Once the parent learns that the child has been terminated, it goes on to terminate also. If
the parent gets to this point, it’s because all has gone well.
How many number of processes will be created in the following
program? Prove your answer by making a replica code that will count no
of processes created.
int main()
{
fork()
fork()
fork()
fork()
}
Develop a stopwatch with a lap counter and a total time calculator. The
program will create two processes and they will start calculating time.
One process will be used to calculate total time and the other will calculate
lap time. The total time calculator process will keep on calculating time.
In the lap time, the calculator process when it reaches lap time limit, the
process will display lap number and set its counter to zero and start
calculating again. Take input of lap time and the number of laps from the user
and start the program. In the end, display the total time from the total time
calculator process.
Write a program that takes a string from the user and you have to do
following tasks with the string:
1. Reverse
2. Find Length
3. Sort
You have to create a child of child’s as given below process tree for each task and
each child exec with the image of the program of a particular task. Print the string after
each operation.
P->C->C->C->C->C
Using exec system call list all the files and directories of home then
store the result in “output1.txt”. Run a second command “grep” and find
the word “output1.txt” in all the text files of the home also place the home
path in the “PATH” environment variable while doing exec for grep. This all
will be done in one process.
Write a C++ program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, sweet, hot, and zesty.
The program should use two parallel 5-element arrays: an array of strings that holds the five salsa names and an array of integers that holds the number of jars sold during the past month for each salsa type. The salsa names should be stored using an initialization list at the time the name array is created.
The program should prompt the user to enter the number of jars sold for each type. Once this sales data has been entered, the program should produce a report that displays sales for each salsa type, total sales, and the names of the highest selling and lowest selling products.
Input Validation: Do not accept negative values for number of jars sold.
Write a C++ program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, sweet, hot, and zesty.
The program should use two parallel 5-element arrays: an array of strings that holds the five salsa names and an array of integers that holds the number of jars sold during the past month for each salsa type. The salsa names should be stored using an initialization list at the time the name array is created.
The program should prompt the user to enter the number of jars sold for each type. Once this sales data has been entered, the program should produce a report that displays sales for each salsa type, total sales, and the names of the highest selling and lowest selling products.
Input Validation: Do not accept negative values for number of jars sold.
Write a C++ program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election