Preview

Rational Number Class in Java

Good Essays
Open Document
Open Document
1459 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Rational Number Class in Java
RATIONAL NUMBER CLASS IN JAVA

AIM To write a program to find the rational form of rational number.
ALGORITHM
1. Start the program. 2. Declare the class name as rational and assign num, den as two parameters. 3. Declare constructor as rational and numerator and denominator as parameter. 4. Then write to string () method to print the rational class object as a string. 5. To get the GCD value using static method use GCD (int m, int n) method. 6. Get the num and den from the user by using string[]. 7. The error by using try, catch blocks. 8. Stop the program.

DATE CLASS IN JAVA

AIM To develop a date class in java similar to the one in java.util.package using java doc commands.

ALGORITHM 1. Start the program 2. Define a class myDate that inherits the Date class from java.util.package. 3. Declare the variables required to store the information regarding data and time. 4. Override the methods to access the date and time properties of the system. 5. Use to string() method to efficiently display the class in string representation. 6. Use java doc commands to create documentation of the program. 7. Stop the program.

IMPLEMENTATION OF LISP-LIKE LIST

AIM To write a java program to execute LISP-LIKE LIST in java.

ALGORITHM 1. Start the program. 2. Create a class to implement the LISP-LIKE LIST and its operation. 3. Get an array of input from the user and store it in the zeroth index of LISP-LIKE LIST, Next data in first index and so on. 4. When the index is given by the user as input display the address in which the indexed data are stored. 5. On users request for the given index display all the data stored array format. 6. Stop the program.

JAVA INTERFACE FOR ADT STACK

AIM To write a java program to design a java interface for ADT stack.

ALGORITHM
Array List Class 1. Start the program. 2. Declare the class named ArrayList Example and create an object named arrlist. 3.

You May Also Find These Documents Helpful

  • Satisfactory Essays

    PT1420 Chapter 3 Review

    • 1062 Words
    • 8 Pages

    4. Assume the variables result, w, x, y, and z are all integers, and that w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements?…

    • 1062 Words
    • 8 Pages
    Satisfactory Essays
  • Powerful Essays

    1. The program will present a series of user screens that prompts the user for specified input.…

    • 1488 Words
    • 6 Pages
    Powerful Essays
  • Satisfactory Essays

    a. Write a C++ function named fracpart() that returns the fractional part of any number…

    • 720 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    it the functions listed below for Exercise 2. In each case, the appropriate error message should be generated if an invalid condition occurs. For example, an error message should be generated when trying to insert an item in a given location in the list and the location is out of range, a. ArrayList(inl size): create a constructor that sets the size of the array list to the value passed in size (note that the class variable SIZE cannot be final anymore), b. int length(): create this function to determine the number of items in the list (accessor function), c. int gelSize(): create this function to determine the size of the list (accessor function), d. void clear(): create this function to remove all of the items from the list. After this operation, the length of the list is zero, e. void replace(int location, int item): create this function to replace the item in the list at the position specified by location. The item should be replaced with item. f. void insert(int location, int item): create this function to add an item to the list at the position specified by location, g. void remove(int item): create this function to delete an item from the list. All ...…

    • 714 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    unit 7 assignment 1

    • 431 Words
    • 2 Pages

    7. Convert the While loop in the following code to a Do-While loop: int x;…

    • 431 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    This is our first individual assignment for Programming unit this semester. This assignment was given in December 2013, and submission date is on 10th February 2014.…

    • 1859 Words
    • 8 Pages
    Good Essays
  • Better Essays

    Prg/420 Week 5

    • 958 Words
    • 4 Pages

    The Calendar Class and it’s associated methods are used by three methods. The programmer can import the calendar class and whatever specific method or constructor they will use in their program by importing it as…

    • 958 Words
    • 4 Pages
    Better Essays
  • Satisfactory Essays

    unit 3

    • 313 Words
    • 2 Pages

    4. Assume the variables result, w, x, y , and z are integers, and that w=5, x=4, y=8, and z=2. What value will be stored in result in each of the following statements?…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Use what you’ve learned about the binary numbering system in this chapter to convert the following decimal numbers to binary:…

    • 259 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    4. Assume the variables result, w,x, y, and z are all integers, and that w= 5, x= 4, y=8 and z=2. What will the values be stored in result in each of the following statements?…

    • 748 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    CMIS 102 Homework 3

    • 342 Words
    • 3 Pages

    Analysis – First I need to declare A, B, C, D, F and GPA as integers.…

    • 342 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Medical Coding

    • 450 Words
    • 2 Pages

    I. The first step in coding is to locate the main term in the Alphabetic Index.…

    • 450 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Week 1 Homework

    • 843 Words
    • 5 Pages

    c. Design an algorithm in pseudocode to solve this problem. Make sure to include steps to get each input and generate each output.…

    • 843 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Linux Directory Log

    • 472 Words
    • 3 Pages

    Directions: As you complete each of the following steps, keep track of what occurs at each point, including what you type, the output given, and if you experience any errors. Record the occurrences in the following matrix.…

    • 472 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Onetop Master

    • 439 Words
    • 2 Pages

    A method is declared as public static void showResults(double d, int i). Which of the following is a correct method call?…

    • 439 Words
    • 2 Pages
    Good Essays

Related Topics