Question: Arithmetic, User Inputs, Scanner Objects, Methods II Part 0 Download the following starter code: Lab 2 a . java Download Lab 2 a . java
Arithmetic, User Inputs, Scanner Objects, Methods II
Part
Download the following starter code: Labajava Download Labajava and Labbjava Download Labbjava
As you progress through the lab, look over the relevant starter code file and make sure you know what material has been provided for you.
Part
Laba
Write a method called kelvins that takes as input that is as argument a temperature in degrees Fahrenheit of type double and returns the temperature in degrees Kelvin also a double Here is the mathematical formula for conversion:
Write another method called temperaturePrinter that takes as input ie as argument two doubles and prints the following message to the screen:
### deg. F equals ### deg. K
Where ### are correct values in degrees Fahrenheit and Kelvin.
Test your methods with different values for Fahrenheit. Either print the results of each test as they are run, or record the results of the tests in comments.
Part
Write a method called secondTime that takes as argument an integer corresponding to a number of seconds. secondTime should compute and display the equivalent time in hours, minutes and seconds, printing the result to console in the format:
secondTime; should generate:
seconds ::meaning hours, min, seconds
Hint: Use a tool like ToolsNoobs Links to an external site. to help determine the correct answer so that you can test your code.
Write another method called inSeconds that takes as arguments three integers: hours, minutes and seconds, computes the exact time in seconds, then returns the total number of seconds and prints the following message to the console:
inSeconds; should generate:
:: seconds
Write the following tests of your methods and submit the outputs with your codebase.
inSeconds;
secondTime;
inSeconds;
secondTime;
inSeconds;
Part
Labb
Make sure that you are done with Laba before you move on to this part. In this exercise you will:
Use two methods from the Math library, namely max and min. Here is a quick introduction to these methods: they each take two numeric inputs ie arguments and return whichever number is the maximum or minimum depending on if you are using max or min of the two. Lets try them out! In main, declare and initialize variables as follows:
double maxNumber Math.max;
double minNumber Math.min;
double maxNumber Math.max;
double minNumber Math.min;
What are their values? Write them down somewhere. Now print them to the screen, did you get what you expected? If not, reflect on the reason and ask someone. Make sure you understand how to use these methods before proceeding.
Write a program in main that asks the user of your program to first enter his or her name followed by real numbers that is any number from infty to infty Your program should sort the three numbers in descending order, then print to the screen a greeting to the person and the sorted numbers. For example your input in blue
Please enter you name followed by three numbers space separated:
Leonardo
Hi there, Leonardo! Here are the numbers you entered in descending order:
and
Thank you for using the threenumbersorting system! Goodbye.
Note: You must use the Math.max and Math.min methods introduced above. The class has not covered conditionals, so please avoid using conditionals!
Make sure to run your program several times and test it with several inputs of different order
Submittal:
Submit both Labajava and Labbjava files to Canvas by the due date.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
