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 - Input Projects


1. Create a new Class and call it InputAddition. Write a program that prompts the user for two numbers (int) adds them together and displays the answer.

Sample Output:
This program will add two numbers together
Enter first number: 10
Enter second number: 25
10 + 25 = 35
TURN IN

2. Create a new Class and call it InputName. Write a program that prompts the user their first name and their last name.  These variables should be Strings.  Then printout a welcome message using their first and last name.

Sample Output:
This program will input the users name and print out a welcome message
Enter first name: Bill
Enter last name: Gates
Welcome to Java, Bill Gates!
TURN IN

3. Create a new Class and call it InputArea. Write a program that asks the user for the area (double) of a circle. Then calculate the radius (double) of the circle and print it out.  To find the radius of a circle use the formula Math.sqrt(area/Math.PI)

Sample Output:
This program calculate the radius of a circle with the given area
Enter the area of a circle: 10
The radius of your circle is 1.78
TURN IN

Robert E. Lee High School
1809 Market
Baytown, TX 77520
281-420-4535
digital media | computer programming I and II | BIM
ap computer science | architectural cad | video game design
national technical honor society | contact me