Question: Please help with Java!!! 1. import java.util.Scanner; public class LAB02part1 { public static void main(String[] args){ // Scanner class to take input from user Scanner
Please help with Java!!!

1. import java.util.Scanner;
public class LAB02part1 { public static void main(String[] args){ // Scanner class to take input from user Scanner scan = new Scanner(System.in); System.out.print("Please enter the coordinates of the two points : "); double x1 = scan.nextDouble(), y1=scan.nextDouble(); double x2 = scan.nextDouble(), y2=scan.nextDouble(); // Prints the mid point System.out.println("The midpoint of (" + x1 +','+ y1 + ") and (" + x2 + "," + y2 + ") is ("+midPoint(x1,x2)+","+midPoint(y1,y2)+")"); }
// Returns the mid point between two points public static double midPoint(double coordinate1, double coordinate2) { double mid = (coordinate1+coordinate2)/2; return mid; }
2. public class LAB02part2 { public static void main(String[] args) { int hours, minutes, seconds; System.out.print("Please enter the number of hours minutes and seconds: "); var scan = new java.util.Scanner(System.in); hours = scan.nextInt(); minutes = scan.nextInt(); seconds = scan.nextInt(); int totalseconds = (3600*hours) + (60*minutes) + seconds; System.out.printf("That is %d sec%n", totalseconds); } }
3. public class LAB02part3 {
public static void main(String[] args) { int hours, minutes, seconds; System.out.print("Please enter the number of seconds: "); var scan = new java.util.Scanner(System.in); seconds = scan.nextInt(); // First, compute the number of hours in the given number of seconds hours = seconds / 3600; // 3600 seconds = 1 hours // Compute the remaining seconds after the hours are accounted for seconds = seconds % 3600; // Next, compute the number of minutes in the remaining number of seconds minutes = seconds / 60; // 60 seconds = 1 minute // Compute the remaining seconds after the minutes are accounted for seconds = seconds % 60; // Report the results System.out.printf("That is %d hr, %d min, %d sec%n", hours, minutes, seconds); }
}
4. import java.util.Scanner ; public class LAB02part4 {
public static void main(String[] args) { { System.out.print ("How many bean burritos, bowls of salad, and milk shakes did you consume? "); var scan = new java.util.Scanner(System.in); int number1 = scan.nextInt(); int number2 = scan.nextInt(); int number3 = scan.nextInt();
int cal; int a=number1; int b=number2; int c=number3; cal=357*a+185*b+388*c; double miles = cal/100.0;
System.out.println ("You ingested " + cal + " Calories "); System.out.println ("You will have to run " + miles + " to expend that much energy."); }
} }
}
In this lab you will reorganize into methods work you already have completed. What to do formatting, etc.), so make the program as attractive to the user as you can. To recap the program's functionality, you must enable the user to be able to do the following activities: compute the midpoint between two points, convert hours, minutes, and seconds to total number of seconds, convert total number of seconds to hours, minutes and seconds, and compute total calories consumed and miles required to run to bum off those calories after consuming a quantity of burritos, salads, and milkshakes. Please refer to https://wm.cs.southern.eduhalterman/Courses/Winter2023/124/Labs/lab02. W23.html for details about these activities. The code for each of these activities must appear in a separate method; thus, your program must implement the four activities in four separate methods. You may layout your menu as you wish. One approach looks like the following
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
