JAVA code problem

Question

Week007 – Machine Problem 2

 

Objective/s:

At the end of this activity, you should be able to:

·       define a class

·       instantiate objects of the class

·       invoke the methods of the class

·       implement the required output

 

What to Prepare for the Activity:

  • NetBeans IDE 8.2
  • JDK8 (Java Development Kit 8)

 

Procedure:

  • Create a NetBeans project for this activity.  The project name should be as follows: 
  • The class names to be created are the following:
    • Math (the main class that contains the main method)
    • Fraction (the class where attributes and methods are defined)
  • Compress the NetBeans project into .rar or .zip format and then upload to the link provided in the LMS.
  • Only NetBeans project compressed in .rar or .zip format will be accepted.  All other formats will be graded with 0.

Project Name: MP2_<lastname_firstname>

Example: MP2_Blanco_Maria

 

 

Write a Java program with the following specifications:

 

  • Define 2 private attributes in Fraction class, the numerator and the denominator.  Define the constructor for this class.
  • Define the setters (mutators) and the getters (accessors) for the Fraction class.
  • Define also the following custom methods in the Fraction class:
  • The fraction types are as follows:
    • Proper Fraction – numerator is less than the denominator
    • Improper Fraction – numerator is greater than the denominator, but the quotient is a real number (ex: 3.45)
    • Whole Number – numerator is greater than the denominator, but the quotient has no decimal part
  • Create a main class named Math.  This class should contain the main method.
  • Instantiate an object of the Fraction class in the main method.
  • Invoke the methods of the Fraction class in the main method to display the requirements as shown in the sample output:
  • The program should loop back to data entry upon confirmation by the user and will terminate as confirmed by the user.
  • Assume that the program user will only input integer values.
  •          
  • showFractionForm
  • determineLowestTerm
  • determineDecimalEquivalent
  • determineFractionTy
  •    

Sample Output:

 PLS SEE ATTACHED FILE. 4 Different problem. 

 

 

 

 

 

 

Details
Attachments
Purchase An Answer Below

Have a similar question?