Page 1 of 9 1234 ... LastLast
Results 1 to 10 of 90
  1. #1

    Default Need help in JAVA plsss.. help 25problems..


    Problems:
    1. Write a Java class called Factorial which defines a main() method that asks the user to enter a positive integer n and displays the factorial of n. The factorial of an integer n, denoted n!, is defined as n * (n-1) * (n-2) * ... * 1 (but note that 0! is 1).
    2. Write a Java class called Fibonacci which defines a main() method that asks the user to enter a positive integer n, and computes the nth Fibonacci number. The nth Fibonacci number is defined by this formula:
    o 0th Fibonacci number: 0
    o 1st Fibonnaci number: 1
    o nth Fibonacci number (for n >= 2): (n-1)th Fibonacci number + (n-2)th Fibonacci number
    3. Write a Java class called CheckPrimality which defines a main() method that asks the user to enter a positive integer n, and displays whether or not n is a prime number. A prime number is an integer which cannot be divided evenly except by 1 and itself.
    4. Write a Java class called Power which defines a main() method that asks the user to enter a double base and a positive integer exponent, and displays base to the power of exponent. You may assume that base and exponent are not both 0. You must write the computation yourself; in other words, you MUST NOT use the Math.pow() method.
    5. Write a Java class called CountDigits which defines a main() method that asks the user to enter a positive integer n, and displays how many digits are in n.
    6. Write a Java class called Contains which defines a main() method that asks the user to enter a String s and a character c, and displays whether or not c occurs in s. You MUST NOT use any methods defined in the String class other than chartAt() and length().
    7. Write a Java class called CountOccurrences which defines a main() method that asks the user to enter a String s and a character c, and displays the number of times c occurs in s.
    8. Write a Java class called CheckDuplicates, which defines a main() method that asks the user to enter a String s, and displays whether or not any character in s occurs more than once.
    9. Write a Java class called MostOftenOccurring which takes a String s and displays the character which occurs most often in String s. If there is a tie, display the character which occurs first in s among those which occur most often.
    10. Write a Java class called ToUpperCase which defines a main() method that asks the user to enter String s and displays a new String which contains exactly the same characters as s in the same order, except that all lower-case letters occurring in s are replaced by their upper-case equivalents in the result String. You MUST NOT use any methods defined in the String class other than charAt() and length().
    11. Write a Java class called IsAlphabetPermutation, which defines a main() method that asks the user to enter a String s and displays whether or not s is a permutation of the upper case letters in the alphabet.
    12. Write a Java class called OccursHere, which defines a main() method that asks the user to enter two Strings, superString, and subString, as well as a positive integer position, and displays whether or not subString occurs in superString at position position. You may assume that position is within the range [0, superString.length() - 1]. You MUST NOT use any methods defined in the String class other than charAt() and length().
    13. Write a Java class called OccursAnywhere, which defines a main() method that asks the user to enter two Strings, superString and subString, and displays whether or not subString occurs anywhere in superString. You MUST NOT use any method defined in the String class other than chartAt() and length().
    14. Write a Java class called Substring, which defines a main() method that asks the user to enter a String s, a positive integer position, and a positive integer number, and displays a new String formed by taking the number characters of s starting at position position. If there are less than number characters between position and the end of s, your main() method should display a new String formed by these characters. You MUST NOT use any methods defined in the String class other than charAt() and length().
    15. Write a Java class called RemoveAll, which defines a main() method that asks the user to enter a String s and a character c, and displays a new String consisting of all the characters in s in the order in which they appear in s, but with all occurrences of c removed. You MUST NOT use any of the methods defined in the String class other than charAt() and length().
    16. Write a Java class called NumberConsecutiveOccurrences, which defines a main() that asks the user to enter a String s, a character c, and an integer position, and displays the number of occurrences of c starting at position position in s. For example, if s is "abbbbbaaa", c is 'b', and position is 1, then your main() method will display 5, as there are 5 consecutive occurrences of 'b' starting at position 1. You may assume that position is within the range [0, s.length() - 1]. You MUST NOT use any methods defined in the String class other than charAt() and length().
    17. Write a Java class called MaxConsecutiveOccurrences, which defines a main() method that asks the user to enter a String s and a character c, and displays the position in s at which the longest series of consecutive occurrences of c occurs. If there is a tie between two positions, you should return the lowest position. You MUST NOT use any of the methods defined in the String class other than charAt() and length().
    18. Write a Java class called Reverse, which defines a main() method that asks the user to enter a String s, and displays a new String consisting of the characters in s in the reverse order. You MUST NOT use any methods defined in the String class other than charAt() and length().
    19. Write a Java class called IsPalindrome, which defines a main() method that asks the user to enter a String s, and displays whether or not s is a palindrome. A palindrome is a String which reads the same forwards and backwards, such as "laval" or "stressed desserts".
    20. Write a Java class called KillWhiteSpace, which defines a main() method that asks the user to enter a String s, and displays a new String consisting of all the characters in s, but with the leading and trailing white space removed. In addition, every sequence of spaces within the String is reduced to one space only. You MUST NOT use any methods defined in the String class other than charAt() and length().
    21. Write a Java class called Equals, which defines a main() method that asks the user to enter two Strings s1 and s2, and displays whether or not s1 and s2 are equal. Two Strings are equal if they are of the same length and the same characters appear in the same positions. You MUST NOT use any of the methods defined in the String class other than charAt() and length().
    22. Write a Java class called DestroyAllOccurrences, which defines a main() method that asks the user to enter two Strings superString and subString, and displays a new String consisting of all characters in superString with all occurrences of subString deleted. You MUST NOT use any of the methods defined in the String class other than charAt() and length().
    23. Write a Java class called SubSet, which defines a main() method that asks the user to enter two Strings superString and subString, and displays whether or not all the characters of subString occur anywhere in superString. You MUST NOT use any of the methods defined in the String class other than charAt() and length().
    24. Write a Java class called AppearInOrder(), which defines a main() method that asks the user to enter two Strings subString and superString, and displays whether or not all the characters of subString appear in order in superString. You MUST NOT use any of the methods defined in the String class other than charAt() and length().
    25. Write a Java class called CountWords, which defines a main() method that asks the user to enter a String s, and displays the number of words in s. A word is delimited by one or many space characters. You MUST NOT not use any of the methods defined in the String class other than charAt() and length(). In addition, you MUST NOT use the StringTokenizer class.

  2. #2
    wow, a database of assignment in Java Class! LOL!

    Is this for your class? Or bring home ni nga exam?

  3. #3
    its for our class..
    ang problem lang kay CmpE mi...
    nia ala bya java sa CmpE...

  4. #4
    for number 10...
    public class Problem10{

    public static void main(String args[]){

    String name="";

    System.out.println("ToUpperCase\n\n");
    System.out.print("Enter a string: ");
    name = Input.readString();

    String upper = name.toUpperCase();
    System.out.println("String is: " + upper);


    }
    }

  5. #5
    its for our class!! these are bonus program...
    ang problema ky di mi I.T. and CS.. wer jsut CMPE gmay ra d teach sa amoa..

  6. #6
    prob #10: alpha characters converted to int value, bacin magamit ni nmo..hehehe
    a - z = 97 - 122
    A - Z = 65 - 90

    to change 'a' to 'A': 97 - 32 = 65 and 'z' to 'Z': 122 - 32 = 90

  7. #7
    kanus-a ni gamiton?

  8. #8
    Quote Originally Posted by Maikeru View Post
    kanus-a ni gamiton?
    March pa deadline ani..

  9. #9
    Quote Originally Posted by FrozenBoi View Post
    March pa deadline ani..
    Dugay pa man diay, kalma lang... hehehe

  10. #10
    ha? wlay java sa compE? asa mo nga skul bro f u dnt mind me askin...

  11.    Advertisement

Page 1 of 9 1234 ... LastLast

Similar Threads

 
  1. Need Help in java. AGAIN! =)
    By jairoh_ in forum Programming
    Replies: 11
    Last Post: 02-29-2012, 08:13 AM
  2. Help in java. Arrays
    By jairoh_ in forum Programming
    Replies: 25
    Last Post: 02-03-2012, 07:48 PM
  3. Help in java
    By jairoh_ in forum Programming
    Replies: 12
    Last Post: 01-11-2012, 10:22 AM
  4. NEED HELP in JAVA EXCELAPI
    By rastaman81 in forum Programming
    Replies: 1
    Last Post: 05-11-2009, 09:17 PM
  5. need help in java programming: creating a folder
    By rastaman81 in forum Programming
    Replies: 4
    Last Post: 03-11-2009, 08:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top