Explain in your own words how and why final variables are used. Illustrate your answer using the code below, explaining how it could be improved by the introduction of final variables. This code is intended to print the areas of 100 circles whose radius is input. The function, inputlnt, returns an integer input by the user. Note you are not required to explain or trace this code, just use it to illustrate points you make about final variables. public static void circles () { for (int i = 1; i <= 100; i ++) { int radius inputInt("What is the radius?"); = 3.14 * radius * radius; double area System.out.println(area); }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 10SA
icon
Related questions
Question

Just explain it and don't use bullet points and also the code written doesn't need to be breaker through it's just to be taken a little help from. The code is not the main thing in this question 

a)
Explain in your own words how and why final variables are used. Illustrate
your answer using the code below, explaining how it could be improved by the
introduction of final variables.
This code is intended to print the areas of 100 circles whose radius is input. The
function, inputInt, returns an integer input by the user.
Note you are not required to explain or trace this code, just use it to illustrate
points you make about final variables.
public static void circles ()
{
for (int i
= 1; i <= 100; i ++)
{
int radius
inputInt("What is the radius?");
3.14 * radius * radius;
||
double area
System.out.println(area);
}
Transcribed Image Text:a) Explain in your own words how and why final variables are used. Illustrate your answer using the code below, explaining how it could be improved by the introduction of final variables. This code is intended to print the areas of 100 circles whose radius is input. The function, inputInt, returns an integer input by the user. Note you are not required to explain or trace this code, just use it to illustrate points you make about final variables. public static void circles () { for (int i = 1; i <= 100; i ++) { int radius inputInt("What is the radius?"); 3.14 * radius * radius; || double area System.out.println(area); }
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT