Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1.  
  2. /*******************************************************************************
  3. * Program Name: Inclass01A
  4. * Program Description: This program uses Cramer's rule to calculate the values
  5. * of x and y for two linear equations.
  6. * If:
  7. * ax + by = e
  8. * cd + dy = f
  9. * Then:
  10. * x = ( ed - bf ) / ( ad - bc )
  11. * and y = ( af - ec ) / ( ad - bc )
  12. * Program Author: Meghan Jerrild
  13. * Date Created: 01/24/2017
  14. * Change# Change Date Programmer Name Description
  15. * ------- ----------- --------------- -----------
  16. */
  17. package inclass01a;
  18.  
  19.  
  20. public class Inclass01A {
  21.  
  22. public static void main(String[] args) {
  23. System.out.println("Cramer's Rule states:");
  24. System.out.println("---------------------");
  25. System.out.println("If:");
  26. System.out.println(" ax + by = e");
  27. System.out.println(" cx + dy = f");
  28. System.out.println("Then:");
  29. System.out.println(" x = ( ed - bf ) / ( ad - bc )");
  30. System.out.println(" y = ( af - ec ) / ( ad - bc )");
  31. System.out.println("Using Cramer's Rule, the values of x and y for the following two equations:");
  32. System.out.println(" 3.4x + 50.2y = 44.5");
  33. System.out.println("2.1x + 0.55y = 5.9");
  34. System.out.println("are:");
  35. // calculate x and y values for input:
  36. double x = (( 44.50 * 0.55 - 50.20 * 5.90) / ( 3.40 * 0.55 - 50.20 * 2.10 ));
  37. // end calculations
  38. System.out.println("x = " + x);
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement