Mr. Truncale - Robert E. Lee High School
  • Home
  • Digital Media
    • HTML
  • Video Game Design
  • Comp. Programming I
  • Comp. Programming II
  • AP Computer Science
  • 3D Printing
  • Teacher Resources
  • Contact Me

Java Lesson 7 - Input From Keyboard

Videos


Text


Download as PDF
READ text then COMPLETE assignments below.
Your browser does not support viewing this document. Click here to download the document.

Assignments


Project - Going in Circles

The area of a circle is given by:
area = π (r2)

Now, suppose we know the area and wish to find r. Solving for r from this equation yields:
squareroot(area/π)
Write a program (project and class both named RadiusOfCircle) that uses sqrt( ) and PI from the Math class to solve for the radius of a circle. Use keyboard input to specify the area (provide for the possibility of area being a decimal fraction).

Write out your solution by hand and then enter it into the computer and run. Before inputting the area, put a prompt on the screen like this.
What is the area? _   
(the underscore indicates the cursor waiting for input) 
Present your answer like this:
Radius of your circle is 139.4.

Submit

Project - What's Your Name

From the keyboard enter your first and then your last name, each with its own prompt. Store each in a separate String and then concatenate them together to show your full name. Call both the project and the class FullName. When your program is finished running, the output should appear similar to that below:

What is your first name? Cosmo 
What is your last name? Kramer 
Your full name is Cosmo Kramer.
Submit
Powered by Create your own unique website with customizable templates.