Answer:
The program in C++ is as follows:
#include <iostream>
using namespace std;
int perimeter(int side1, int side2, int side3){
return side1+side2+side3;
}
struct Triangle {
int side1; int side2; int side3;
};
int main(void) {
int side1, side2, side3;
cout<<"Sides of the triangle: ";
cin>>side1>>side2>>side3;
struct Triangle T;
T.side1 = side1;
T.side2 = side2;
T.side3 = side3;
cout << "Perimeter: " << perimeter(T.side1,T.side2,T.side3) << endl;
return 0;
}
Explanation:
See attachment for complete code where comments are as explanation
Answer:
Explanation:
The following code is written in Java. It creates the abstract dollar class that has two instance variables for the dollars and the coins that are passed as arguments. The test output can be seen in the picture attached below.
class Dollar {
int dollars;
double coin;
private Dollar(int dollar, int coin) {
this.dollars = dollar;
this.coin = Double.valueOf(coin) / 100;
}
}
Electric power and electrical energy are related because electrical energy comes from electrical power. If one comes from the other, they are related. Hope this helps!