Question: In java TASK: Fill in the program below such that it does the following: . Prompt the user to enter the first number by printing

In javaIn java TASK: Fill in the program below such that it doesthe following: . Prompt the user to enter the first number by

TASK: Fill in the program below such that it does the following: . Prompt the user to enter the first number by printing the following: "Enter the first number:" (no quotes) Read the next double entered by the user, and store it in a variable called firstNum Prompt the user to enter the second number by printing the following: "Enter the second number:" (no quotes) Read the next double entered by the user, and store it in a variable called secondNum Prompt the user to enter an operation by printing the following: "Enter the operation:" (no quotes) Read the next String entered by the user, and store it in a variable called operation Depending on the value of operation, do one of the following: If operation is "add", print firstNum + secondNum If operation is "subtract", print firstNum - secondNum If operation is "multiply", print firstNum * secondNum If operation is "divide", print firstNum / secondNum If operation is "modulo", print firstNum % secondNum If operation is none of the above, print the string "Invalid operation: operation" (no quotes) EXAMPLE: The program should always first prompt me with the following: Enter the first number: If I type "12.3" (no quotes) and hit enter, it should prompt me with the following: Enter the second number: If I type "45.6" (no quotes) and hit enter, it should prompt me with the following: Enter the operation: If I type "add" (no quotes) and hit enter, it should print the following: 57.9 EXAMPLE: If I do the exact same steps as above, but when prompted for an operation, I type "power" (no quotes) and hit enter, it should print the following: Invalid operation: power TASK: Write a public static method called readMessage that has a parameter of type String called filename. It should read the contents of the file with filename filename and return the resulting String EXAMPLE: If I had a file called message.txt with the following contents: Hello, World! Calling readMessage("message.txt") would return "Hello, World!" NOTE: I had to write my own hack-y FileReader class to avoid forcing you all to do more Linux challenges, so it only supports the FileReader(String fileName) constructor and the read() method (which reads a single character as an int that you can cast to char). If you try to use anything outside of these, it will break Sample Input: Hello, World! message.txt Sample Output: Hello, World

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!