Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using C++ what would be the program/code I would use to solve this problem Wrie

ID: 3865250 • Letter: U

Question


Using C++ what would be the program/code I would use to solve this problem

Wrie a complete program that determines the equation of a plane given its three intercepts. The illustration below shows a plane with intercepts (a, 0, 0), (0, b, 0) and (0, 0, c). (0, 0, c) 0 0, b, 0) (a, 0, 0) 1. Problem Statement A plane in "general" orientation, and which does not pass through the origin, will intersect each of the three axes at the points (a, 0, 0), (0, b, 0) and (0, 0, c). These three points are called the plane's "intercepts". The task for this final assignment is to come up with the equation of the plane with these given intercepts.

Explanation / Answer

The equation of a plane in the intercept form is

x/a + y/b + z/c = 1

where a, b , c are intercepts on x, y and z axis. a, b and c are non-zero

(You can get the equation from google. Example : http://www.solitaryroad.com/c401.html)

So the we need to write the program to accept a, b and c and find out 1/a, 1/b and 1/c and display the equation of the plane. The following code does that ...

If the answer helped, please don't forget to rate it. Thank you.

#include <iostream>
#include <iomanip> //used for formatting output with 3 decimal places

using namespace std;
int main()
{
double a, b, c;
double inv_a, inv_b, inv_c;
  
cout << "Enter x intercept i.e 'a' : ";
cin >> a;
cout << "Enter y intercept i.e 'b' : ";
cin >> b;
cout << "Enter z intercept i.e 'c' : ";
cin >> c;
  
//find the inverse of a , b and c
inv_a = 1/a;
inv_b = 1/b;
inv_c = 1/c;
  
  
cout << fixed << setprecision(3) ; //for displaying with 3 decimal points
  
cout << "The equation of the plane with intercepts a = " << a << ", b = " << b << ", c = " << c << " is " << endl;
  
cout << inv_a << " x ";
  
//decide whether to show + or - sign for y term
if(b < 0)
cout << " - " << -inv_b << " y ";
else
cout << " + " << inv_b << " y ";


//decide whether to show + or - sign for z term
if(c < 0)
cout << " - " << -inv_c << " z ";
else
cout << " + " << inv_c << " z ";
  
cout << " = 1" << endl;
}

output

Enter x intercept i.e 'a' : 4
Enter y intercept i.e 'b' : -5
Enter z intercept i.e 'c' : 3
The equation of the plane with intercepts a = 4.000, b = -5.000, c = 3.000 is
0.250 x - 0.200 y + 0.333 z = 1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote