Programming
4 quick java programs - beginner friendly please

Question Description

I’m studying for my Programming class and don’t understand how to answer this. Can you help me study?

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 )



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