Programming
4 quick java programs - beginner friendly please

Question Description

Need help with my Programming question - I’m studying for my class.

(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 )


Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

fixit (96)
University of Virginia

Anonymous
The tutor was pretty knowledgeable, efficient and polite. Great service!

Anonymous
Heard about Studypool for a while and finally tried it. Glad I did caus this was really helpful.

Anonymous
Just what I needed… fantastic!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4