Write a program that defines a shape class with a constructor that gives value to width and height.
The define two sub-classes triangle and rectangle, that calculate the area of the shape with the help
of method area (). In the main, define two instance variables a triangle and a rectangle and then call
the area() method in this two instance variables.
Q1) write generic functions to add, multiply, subtract and divide any kind of data type’s integer, double, decimal and date types.
Q2) write a generic class to implement same above functionalities in your program.
Write a program that allows the user to input two numbers. Use NUM1 & NUM2 as variables. The program should output 4 answers using 4 different operators which are +, ‐, /, * and MOD. Your Screen should look something like this:
Ans1 =
Ans2 =
Ans3 =
Ans4 =
*using netbeans*
.Create a pseudocode and flowchart that will input values for A and B. Compare two values inputted and print which of the values is higher including the remark “Higher”.
ask the user to enter the year (can be 1,2,3,) &corce (HNDIT,HNDM,HNDA)
if year is 2&corece is HNDIT show him "it is time to garduate soon"
if year is 2&corece is HNDA show him "it is time to garduwate in 2 years "
if year is 3&corece is HNDM show him "it is time to garduwate soon "
if is 1 show him "you have more time in garduwate"
Suppose you are a manager of an event management company. Your team is responsible for running various events. Each event, depending on its nature, runs for varied lengths. Your company policy is such that you charge a flat amount for each event your team is managing (irrespective of the duration a particular event). The size of the team that you are running is such that your team can manage to run one event at a particular time i.e. your company is unable to run multiple events at a particular time. More formally, if there are two events i and j, the events are mutually compatible (i.e. you can select both i andj) if s>f, ors,>fwhere s; and fi are the start and finish time of the event i. You are required to select events that your team is going to manage so that you can maximize the profit for your company. The following table shows some candidate events for your company to manage for a particular day. Find out which events would you select such that you can maximize the profit for your company.
Given a string, an integer position, and an integer length, all on separate lines, output the substring from that position of that length.
Ex: If the input is:
Fuzzy bear
3
4
the output is:
zy b
Note: Using a pre-defined string function, the solution can be just one line of code.
#include <iostream>
#include <string>
using namespace std;
int main() {
string strVal;
int posStart;
int choiceLen;
string newString;
getline(cin, strVal);
cin >> posStart;
cin >> choiceLen;
cout << newString << endl;
return 0;
}
Write a program that prompts the user to input a four-digit positive integer. The program then outputs
the digits of the number, one digit per line. For example, if the input is 3245, the output is:
3
2
4
5