Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Complete Chapter 2, Programming Activity 1: Converting Inches to Centimeters. Make sure you study the Programming Activity 2-1 Guidance document. Which part of the guidance
Complete Chapter 2, Programming Activity 1: Converting Inches to Centimeters.
Make sure you study the Programming Activity 2-1 Guidance document.
Which part of the guidance document was the most helpful to you? Why?
The following is a sample of the output:
5.2 inches are equivalent to 13.208 centimeters.
THIS IS THE GUIDANCE
Programming Activity 2-1 Guidance ================================= Constants --------- Understanding what can change and what cannot change is important. Data that cannot change should be made constant to protect it from change. This is accomplished with the "final" keyword More insight into constants --------------------------- Since the calculation for centimeters involves the value of the inches variable, centimeters is dependent on inches. The value of centimeters can vary only if the compiled-in value of the variable inches is changed. This means it cannot change within a given run of the program, but only from run to run, and only if the program is compiled with a new value for inches. A constant variable is one that should never change, not even in different runs of the program. What value should you use for the "inches" variable? ---------------------------------------------------- In part 2, the framework comments tell you to define a variable named "inches". The comments there also say to "Assign any desired value to this variable". Since the book shows the correct output (13.208) when 5.2 is used, initially use 5.2 to test your code. However, try some other values of your choice and check your results against what the answer should be by checking with a calculator
Step 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