Details of this Paper

Week 7 is open




Comments are REQUIRED, flow charts and Pseudocode are NOT REQUIRED. ************Week 7 is open, the program requires you to use the main method EXACTLY as given, you can add comments but nothing more. Do not modify the call to add or modify as they are the method call chaining that is required.**************;Directions;Points;The files must be called. (driver) (handles the fractional numbers);Example:;Ensure you include ALL files required to make your program compile and run. I would like to see files only.;Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter.;5%;Basic Requirements;Write a driver and fraction class that performs addition, multiplication, prints the fraction, and prints as a double.;;Provide a driver class, LastNameFirstNameProg7, that demonstrates this Fraction class. The driver class should contain this main method;public static void main(String[] args) { Scanner stdIn = new Scanner(, Fraction c, d, x, // Fraction objects;System.out.println("Enter numerator, then denominator."), c = new Fraction(stdIn.nextInt(), stdIn.nextInt()), c.print();System.out.println("Enter numerator, then denominator."), d = new Fraction(stdIn.nextInt(), stdIn.nextInt()), d.print();20%;x = new Fraction(), // create a fraction for number 0;System.out.println("Sum:"), x.add(c).add(d), x.print(), x.printAsDouble();x = new Fraction(1, 1), // create a fraction for number 1;System.out.println("Product:"), x.multiply(c).multiply(d), x.print(), x.printAsDouble();System.out.println("Enter numerator, then denominator.");x = new Fraction(stdIn.nextInt(), stdIn.nextInt()), x.printAsDouble(), } // end main;Note that this demonstration driver does not call the accessor methods. That?s OK. Accessor methods are often implemented regardless of whether there?s an immediate need for them. That?s because they are very useful methods in general and providing them means that future code can use them when the need arises.;;Write a Fraction class called that implements these methods;? add? This method receives a Fraction parameter and adds the parameter fraction to the calling object fraction.;? multiply? This method receives a Fraction parameter and multiplies the parameter fraction by the calling object fraction.;? print? This method prints the fraction using fraction notation (1/4, 21/14, etc.);? printAsDouble? This method prints the fraction as a double (0.25, 1.5, etc.);Separate accessor methods for each instance variable in the Fraction class.;70%;Upload your page to the Dropbox.;NOTE: Complete your activity and submit it to the Dropbox in eCollege;5%;Total Points;100;Sample Output;Enter numerator, then denominator. 5 8 5/8;Enter numerator, then denominator. 4 10 4/10 Sum: 82/80 1.025 Product: 20/80 0.25;Enter numerator, then denominator. 6 0 infinity


Paper#68285 | Written in 18-Jul-2015

Price : $37