Programming
4 quick java programs - beginner friendly please

Question Description

Write a method that computes the sum of the digits of an integer. Use the following method header:

public static int sumDigits( long n )

For example sumDigits( 234 ) returns 9  ( 2+3+4)
Hint: use the % operator

Submit both source code and compiled code ( .java and .class files )




Write a method with the following header to display three numbers in increasing order

public static void displaySortedNumbers( double num1, double num2, double num3 )

Write a test program that prompts the user to enter three numbers and invokes the method to display them in increasing order.

Submit both source code and compiled code ( .java and .class files 



Create a class called MyTriangle that contains the following two methods:

/* Return true if the sum of any two sides is greater than the third side */
public static boolean isValid( double side1, double side2, double side3 )

/* Return the area of the triangle */
public static double area( double side1, double side2, double side3 )

Write a test program that reads three sides for a triangle and computes the area if the input is valid. Otherwise it displays the input is invalid. See Programming Exercise 2.15 for computing the area of a triangle.

Submit both source code and compiled code ( .java and .class files )


Write a method that converts milliseconds to hours, minutes and seconds using the following header:

public static String convertMillis( long millis )

The method returns a string as hours:minutes:seconds
For example, convertMillis( 5500 ) returns a string 0:0:5 and convertMillis( 5555500000 ) returns a string 154:19:10

Submit both source code and compiled code ( .java and .class files )



Final Answer

fixit (96)
Carnegie Mellon University

Anonymous
The tutor managed to follow the requirements for my assignment and helped me understand the concepts on it.

Anonymous
The tutor was knowledgeable, will be using the service again.

Anonymous
Awesome quality of the tutor. They were helpful and accommodating given my needs.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors