Question: Write a program that reads from the keyboard the radius of a circle. Calculate and output the area and the circumference of that circle. You

  • Write a program that reads from the keyboard the radius of a circle. Calculate and output the area and the circumference of that circle. You can use the following formulas:
  • area = * r
  • circumference = 2 x x
  • Explore the printf method of the PrintStream class in the Java API. The calculated area line of output must also be formatted to two decimal places but this must be achieved using the printf method.
    • Declare a character variable called power and assign it a value of \u00b2. Use this character as needed with the printf method.

Output Requirement

Please enter a value for the radius of a circle in centimeters: [USER SUPPLIED VALUE] The circumference of a circle with a radius of {radius value} is {calculated circumference} cm. The area of a circle with a radius of {radius value} is {calculated area} cm.

I have char power = '\ub002' which i know should be returning a superscript 2 ... but it is just printing out a ? instead.

This needs to be coded in java. Thank you so much.

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!