QuestionQuestion

• Add a method (not the main method) to find the log of a floating point number:
• Use Math.log() for the calculation.
• Prompt the user for the number to find the log of.
• Display the result with an output message. Make sure the output message clearly states what the user is looking at.
• Add a method (not the main method) to find the absolute value of an integer:
• Do not use Math.abs(). Use an if statement to determine if it is positive or negative.
• Prompt the user for the number.
• Display the result with an output message. Make sure the output message clearly states what the user is looking at.
• Add a main method to the program:
• Create a menu asking the user to choose which calculation to perform or to quit.
• Use a switch statement with the menu to determine which option to use. Include a default message in case the user enter's an invalid option.
• Include an exit message if the user chooses to quit.
• Compile and run your code.
• Submit your source code as a plain text file with a .java extension. Make sure it compiles without error before submitting it.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public static void main(String[] args) {
       Scanner s = new Scanner(System.in);
       int selection = 0;
       while (selection != 3) {
            System.out.print("1. find the log of a floating point number\n"
                   + "2. find the absolute value of an integer:\n"
                   + "3. quit\n"
                   + "--> ");
            selection = s.nextInt();
            switch (selection){
                case 1:
                   log(s);
                   break;...
$10.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats