Question: package edu.wit.cs.comp1050; //TODO: document this class public class LinearEquation { /** * Initialize the linear equation of form: * ax + by = e *

package edu.wit.cs.comp1050; //TODO: document this class public class LinearEquation { /** * Initialize the linear equation of form: * ax + by = e * cx + dy = f * * @param a parameter a * @param b parameter b * @param c parameter c * @param d parameter d * @param e parameter e * @param f parameter f */ public LinearEquation(double a, double b, double c, double d, double e, double f) { // replace with your code } /** * Convenience constructor to initialize * the linear equation via array * * THIS CONSTRUCTOR CALLS THE CONSTRUCTOR * ABOVE USING THE ARRAY CONTENTS * * @param p parameter array, assumed to be length 6 (a-f, in order) */ public LinearEquation(double[] p) { // MUST call the above constructor // with the contents of p } /** * Returns parameter a * * @return a */ public double getA() { return 0.; // replace with your code } /** * Returns parameter b * * @return b */ public double getB() { return 0.; // replace with your code } /** * Returns parameter c * * @return c */ public double getC() { return 0.; // replace with your code } /** * Returns parameter d * * @return d */ public double getD() { return 0.; // replace with your code } /** * Returns parameter e * * @return e */ public double getE() { return 0.; // replace with your code } /** * Returns parameter f * * @return f */ public double getF() { return 0.; // replace with your code } /** * Returns true if the parameterized * equation is solvable (i.e. denominator * ad-bc is not 0) * * @return true if solvable, false otherwise */ public boolean isSolvable() { return false; // replace with your code } /** * Returns solution for x if solvable, * null otherwise * * @return x if solvable, null otherwise */ public Double getX() { return null; // replace with your code } /** * Returns solution for y if solvable, * null otherwise * * @return y if solvable, null otherwise */ public Double getY() { return null; // replace with your code } }package edu.wit.cs.comp1050; //TODO: document this class public class PA3b { /** * Error to display if the command-line arguments are invalid */ public static final String ERR_USAGE = "Please supply 6 numbers (a-f)."; /** * Error to display if the equation has no solution */ public static final String ERR_NOSLTN = "The equation has no solution."; /** * Number of required parameters (a-f) */ public static final int NUM_PARAMS = 6; /** * Validates command-line arguments and returns * parameters if valid * * @param args command-line arguments * @return if valid an array of parameters, else null */ public static double[] validateArgs(String[] args) { return null; // replace with your code } /** * Uses command-line arguments to create * an instance of the linear equation, * and reports the outcome * * @param args command-line arguments, interpreted as equation parameters */ public static void main(String[] args) { // replace with your code } }You are to first implement a class named LinearEquation for a 22 set of linear equations: ax+by=ecx+dy=fx=adbcedbfy=adbcafec The class has two constructors to provide the equation parameters (a-f), six getter methods for these parameters, a method to determine if the linear system is solvable (i.e. whether the denominator of the x/y equations equals 0 ), and methods to get x/y (or null, if the system isn't solvable). You must also write a program that takes the parameters (a-f) via command-line arguments, validates the input, and outputs either an error (due to invalid inputs or a non-solvable system) or the solution (with three decimal places of precision). For example, consider the following runs... \$ java edu.wit.cs.comp1050.PA3b Please supply 6 numbers (a-f). $ java edu.wit.cs.comp1050.PA3b 1.02.02.04.04.05.0 The equation has no solution. $ java edu.wit.cs.comp1050.PA3b 9.04.03.05.06.021.0 Solution: x=2.000,y=3.000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
