Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recitation 1 - Variables, input, and casting

Learning Objective:

  1. Develop experience with Java input and output functionality.
  2. Use type casting to force type conversion without producing a compiler error.
  3. Use different primitive types in Java.

Required Activity

Implement the tasks below in the BasicInput.java file provided with this IntelliJ project.

  1. Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space.
Enter integer:
99
Enter double:
3.77
Enter character:
z
Enter string:
Howdy
99 3.77 z Howdy
  1. Extend to also output in reverse.
Enter integer:
99
Enter double:
3.77
Enter character:
z
Enter string:
Howdy
99 3.77 z Howdy
Howdy z 3.77 99
  1. Extend to cast the double to an integer, and output that integer.
Enter integer:
99
Enter double:
3.77
Enter character:
z
Enter string:
Howdy
99 3.77 z Howdy
Howdy z 3.77 99
3.77 cast to an integer is 3

Submitting Your Work

When you have completed the above tasks, submit the BasicInput.java file by clicking on the CodeGrade link in Blackboard.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages