Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

new data type: named constant a named constant is assigned a value that can not change during the running of the program syntax used to

new data type: named constant
a named constant is assigned a value that can not change during the running of the program
syntax used to declare a named constant: final datatype CONSTANTNAME = value;
for example: final double PI =3.14159;
in math, pi is known as a constant used to compute the area of a circle
go to page 43 of your textbook and read the program under Listing 2.4
predict how the program would run and what output would appear in the output window
open a new NetBeans project, using the same name as the book (ComputeAreaWithConstant)
copy the code into your program (including the comments)
run the program; when the program asks for the radius, enter a number in the output window
then: add a command line on the line below your declaration of PI
PI =3;
what do you think will happen when you run the program?
run it and see what happened (look in the output window)
you should see an error message because you can't reassign a value to a constant
delete the error-causing line of code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago