preview

Rational Number Class in Java

Decent Essays

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 …show more content…

ALGORITHM 1. Create the class calculator that extends JApplet class to display the buttons and obtain input from the user. 2. The init () method is the module gets executed first. This makes a call to the display panel for calculator like structure/ 3. Represent all the numbers and operators as button and use ActionListener to Listed to the User’s input. 4. Whenever click operation is performed on operators store the value in Textbox as the first value and obtain the second value from the Textbox on click is performed on equals operator. 5. Display the result in the Textbox. OBJECT SERIALIZATION AIM To write a java program for performing object serialization. ALGORITHM 1. Start the program. 2. Serialization id obtained by implementing the serializable interface to the currency. 3. Get the randomly generated values and store it an Rupee and Dollars inside a file. 4. Serialize the value from the file and convert all dollar values into rupees by checking the presence of ‘$’ symbol. 5. Display all the values till all the elements in the file are read. 6. Stop the program. JCHECK BOX SWING AIM To write a program to illustrate checkbox control by using java. ALGORITHM 1. Open a notepad. 2. Create a class name as CheckBoxDemo. 3. Declare the TextFile as jtf. 4. Declare the jt cb1, cb2 as JCheckBox and C as container. 5. Create a Icon object. 6. Import Quit and event and

Get Access