GithubHelp home page GithubHelp logo

college-practical's Introduction

  1. Pass student name using command line argument and print output in following format: First Name : abc Second Name : pqr Last Name : str

  2. Write a program to check whether given number is even or odd.

  3. Write a program that displays the value of 2 raised to the power 12.

  4. Write a program check primality of a number.

  5. Write a program to print following triangle with character ‘A’ for n rows, n is to be passed as command line argument. A A A A A A A A A A

  6. Write an application that accepts two doubles as its command-line arguments, multiplies these together, and display the product.

  7. Write an application that converts between meters and feet. its first command-line argument is a number. Its second command-line argument if either “feet” or “meters”. If this argument equal “feet”, display a string reporting the equivalent number of meters. If this argument equal “meters”, display a string reporting the equivalent number of feet. Otherwise, report that the unit system is not recognized. (note: one meter is equal to 3.28 feet.)

  8. Write a program that outputs a table of numbers. Each line in the table contains three entries: the number, its square, and its cube. Begin with 1 and end with

  9. Use While loop to generate random numbers and maintain a running sum of these values. Terminate when the sum exceeds 20. (Note: use Math. random() method to obtain numbers.)

  10. Write an application that generates the first 15 numbers in the Fibonacci series.

    ARRAY

  11. Write an application that creates an array with five Float command line arguments and display the length of the array after creation and its elements.

  12. Write a program that creates and initializes a four element byte array. Calculate and display the average of its values.

  13. Write a program to search in the int array with use of for each style for loop.

  14. Create two dimensional array of int with user given input. Display the summation of all elements of 2D array using for each loop.

    STRING HANDLING

  15. Write a program that will create two strings using new keyword, compare them and show true if they are same, append second to first.

  16. Write a program that will accept a string “java123is234fun” will replace all occurrences of digit with single space character in a new string. (use of replaceAll() function and regular expression for digit). Split the new formed string from space character and form the array of strings (use of split function). Display strings from the array in new line each.

  17. Write a program that displays the substring formed by the last ten characters of a string given as command line argument.(Use length() method)

  18. A string contains five numbers separated by commas .Write a program that displays the last number.

  19. Write an application that counts the total number of characters in all of its command-line arguments.

  20. Write an application that searches through its command-line argument. If an argument is found that does not begin with and upper case letter, display error message and terminate.

  21. A method named average() has one argument that is an array of strings. It converts these to double values and returns their average. Write a program that illustrates how to declare and use this method.

  22. Write an application that reads and processes strings from the console(stays at console). Reverse the sequence of characters in each string and then display it.

  23. Create a StringBuffer object and illustrate the operation of the append() and reverse() methods.

    CLASS

  24. Write a program to create circle class with area function to find area of circle.

  25. Define class complex with a function to add and to compare to complex number.

  26. Write an application that declares a class named Sphere. It should have instance variables to record its radius and the coordinates of its center. This should be of type double. Use the new operator to create a Sphere object. Set and display its instance variables.

  27. Write an application that defines a Circle class with two constructors. The first form accepts a double value that represents the radius of the circle. This constructor assumes that the circle is centered at the origin (will set center coordinates to zero). The second form accepts the three double values. The first two arguments define the coordinates of the center and the third argument defines the radius. Set and display its instance variables.

  28. Write an application that defines a sphere class with three constructors.

The first form accepts no arguments. It assumes the sphere is centered at the origin and has a radius of one unit. The second form accepts one double value that represents the radius of the sphere. It assumes the sphere is centered at the origin. The third form accept four double arguments. These specify the coordinates of the center and the radius.

  1. Create circle class then derive cylinder class with overriding of area calculation method.

  2. Write a program that illustrates method overriding. Class Bond is extended by ConvertibleBond. Each of there classes defines a display() method that outputs the string “Bond” of “ConvertibleBond”, respectively. Declare an array to hold six Bond objects. Initialize the elements of the array with a mix of Bond and ConvertibleBond objects. Execute a program loop to invoke the display method of each object.

  3. Write an application that illustrates how a method can invoke a superclass method. Class I2 is extended by J2.Class J2 is extended by K2.Each of these classes defines a getDescription() method that returns a string. That string includes a description of the class plus descriptions of each superclass. Instantiate each of these classes and invoke the getDescription() method

    Exception handling
    
  4. Write a program that will accept two integers with the use of command line or scanner class. Divide first integer by second, display the result and also handle appropriate exception if second number is zero.

  5. Write a program to accept age of user with the use of commandline or scanner class. Create and throw user defined exception named “InvalidAge” with error message.

college-practical's People

Contributors

shaileshjadav2732 avatar

Stargazers

Kuldeep Rathod avatar Rahul Chauhan avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.