Question: in java Introduction While programming, you will often need to perform some form of mathematical operation. For this task, you will practice declaring variables, grabbing

in java

in java Introduction While programming, you will often need to perform some

Introduction While programming, you will often need to perform some form of mathematical operation. For this task, you will practice declaring variables, grabbing information using the Scanner, and modifying your variables using mathematical operations. Choosing the right data types is a skill that you will develop. In order to do this, we'll compare the outputs of the same operations performed with different data types. Often times, you'll simply want to default to using the set of integers('int). However, in some cases, it makes more sense to use the set of real numbers(double). We'll see this in below where we perform tasks like evaluate fractions and calculate an average. Task In this case program name is MathExpressions which is the name of the class and file of this program. In the corresponding space in the coding template, translate the following expressions into Java and print the results: For A-E you will be using four variables a-d and they will be of type int: A. resultA = a + b-C / 15 B. resultB = 2 / 3 - 2 + 5 + d c. result is equal to the difference between results of A and B D. results is equal to the area of a rectangle if the side lengths are equal to the results of A and c E. results is equal to the average of results A-D For F-J repeat A-E but using four variables e-h of type double (the only difference is the .Os added to the numbers): F. resultF = e + f - g / 15.0 G. resultG = 2.01 3.0 - 2.0 + 5.0 + h H. resulth is equal to the difference between results of F and G I. resulti is equal to the area of a rectangle if the side lengths are equal to the results of F and H J. results is equal to the average of results F-I We can compare the differences between the outputs. Use your intuition to determine which set of numbers (int or double) makes more sense for which cases. Also take notice of the format of the MathExpression.java file. Starting from the top, there are import statements, the class header, the main header, and the code belonging to main The code to create the Scanner is also important to familiarize yourself with. It was provided for you this time, but next lab you will be responsible for coding it if you need user input

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!