Answered step by step
Verified Expert Solution
Question
1 Approved Answer
programming Fundamentals English to Metric Purpose: In this lab, you will practice declaring variables and assigning values derived from simple arithmetic operations. The concepts covered
programming Fundamentals
English to Metric
Purpose: In this lab, you will practice declaring variables and assigning values derived from simple arithmetic operations. The concepts covered in this lab include: declaring variables and assigning values, arithmetic operations, and String concatenation. Task: Create a new Java project or repl titled either EnglishtoMetric_FirstName_LastName or Lab2_FirstName_LastName. You must include comments describing key parts of this program. 1. Make sure the initial code of your application is prepared to write statements in the main method. 2. Declare three variables of type double called miles, gallons, and pounds. These variables should also have the following values assigned: a. miles is assigned the value 5.4979 b. gallons is assigned the value 80 pounds is assigned the value 137 C. 3. Declare three more variables of type double called kilometers, liters, and kilograms. These variables should also have the following values assigned: a. kilometers is assigned the product of miles and 1.60934 b. liters is assigned the product of gallons and 3.78541 C. kilograms is assigned the product of pounds and 0.453592 Keep in mind that the products are the result of multiplying the two values together. 4. These six variables will be used in three print statements to achieve the following output: 5.4979 miles is equal to 8.847990386 kilometers 80.0 gallons is equal to 302.8328 liters 137.0 pounds is equal to 62.142103999999996 kilograms You will need to use String concatenation to combine the variables with String literals to form each of the three statementsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started