Description
(Use the Date Class) Write a program that creates a Date object, sets its elapsed time to 10000, 100000, 10000000, 100000000, 1000000000, 10000000000 and 100000000000 and displays the date and time using the toString() method.
Submit both source code and compiled code ( .java and .class files )
If you need files for this one, tell me please.
(Use the GregorianCalendar class) Java API has the GregorianCalendar class in thejava.util package, which you can use to obtain the year, month and day of a date. The no-arg constructor constructs an instance for the current date, and the methodsget(GregorianCalendar.YEAR), get(GregorianCalendar.MONTH), and get(GregorianCalendar.DAY_OF_MONTH) return the year, month, and day. Write a program to perform two tasks:
- Display the current year month and day
- The GregorianCalendar class has the setTimeInMillis(long) which can be used to set a specified elapsed time since January 1, 1970. Set the value to 1234567898765L and display the year, month, and day.
Submit both source code and compiled code ( .java and .class files )
Write a method that counts the number of letters in a string using the following header:
public static int countLetters( String s )
Write a test program that prompts the user to enter a string and displays the number of letters in the string.
Submit both source code and compiled code ( .java and .class files )
Write a method that finds the number of occurances of a specified character in a string using the following header:
public static int count(String str, char a)
For example, count("Welcome",e) returns 2. Write a test program that prompts the user to enter a string followed by a character and displays the number of occurances of the character in the string.
Submit both source code and compiled code ( .java and .class files )
Explanation & Answer
Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
Rules Of Civility
by Amor Towles
The Sixth Extinction An Unnatural History
by Elizabeth Kolbert
The Kite Runner
by Khaled Hosseini
The Underground Railroad
by Colson Whitehead
A Farewell To Arms
by Ernest Hemingway
Little Fires Everywhere
by Celeste Ng
Catching Fire
by Suzanne Collins
Faust
by Johann Wolfgang von Goethe
Girl in Translation
by Jean Kwok