Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************************************
- * Program Name: Inclass01A
- * Program Description: This program uses Cramer's rule to calculate the values
- * of x and y for two linear equations.
- * If:
- * ax + by = e
- * cd + dy = f
- * Then:
- * x = ( ed - bf ) / ( ad - bc )
- * and y = ( af - ec ) / ( ad - bc )
- * Program Author: Meghan Jerrild
- * Date Created: 01/24/2017
- * Change# Change Date Programmer Name Description
- * ------- ----------- --------------- -----------
- */
- package inclass01a;
- public class Inclass01A {
- public static void main(String[] args) {
- System.out.println("Cramer's Rule states:");
- System.out.println("---------------------");
- System.out.println("If:");
- System.out.println(" ax + by = e");
- System.out.println(" cx + dy = f");
- System.out.println("Then:");
- System.out.println(" x = ( ed - bf ) / ( ad - bc )");
- System.out.println(" y = ( af - ec ) / ( ad - bc )");
- System.out.println("Using Cramer's Rule, the values of x and y for the following two equations:");
- System.out.println(" 3.4x + 50.2y = 44.5");
- System.out.println("2.1x + 0.55y = 5.9");
- System.out.println("are:");
- // calculate x and y values for input:
- double x = (( 44.50 * 0.55 - 50.20 * 5.90) / ( 3.40 * 0.55 - 50.20 * 2.10 ));
- // end calculations
- System.out.println("x = " + x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement