LastInitialFirstInitialUnit3Ch12

profileEngineer_Ankit
 (Not rated)
 (Not rated)
Chat

The files must be called <LastInitialFirstInitialUnit3Ch12.java>

Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter.

Only submit the .java file needed to make the program run. Do not submit the .class file or any other file.

5%

Style Components

Include properly formatted prologue, comments, indenting, and other style elements as shown in Chapter 2 starting page 64 and Appendix 5 page 881-892.

5%

Topics covered in chapter

Topics with * are covered in this assignment. Ensure you use every item listed below in your completed assignment.

*Integer Types and Floating Point Types

*Char Type and ASCII Character Set

*Type Conversions

*Prefix/Postfix Modes for Increment/Decrement

*Embedded Assignments

*Conditional Operation Expressions (ternary)

Short Circuit Evaluation

Empty Statement

Break statement within a loop

*For loop header detail

Enumerated types

*Hexadecimal, Octal, and Binary Numbers

Basic Requirements

Write a program that gets input for a string, then output a substring of this string character by character showing the upper case, lower case, initial case, binary, and hex values of each character. Repeat until quit.

LiFiUnit3Ch12.java

 Get input for a string of any length

40%

 Get input for a substring length (0 to quit)

 Loop through the string using an embedded assignment (pg. 530) in a while loop and printing the following:

o Use a “ternary operator” (pg. 531) that sets the substring length to the actual string length if the value entered for the substring is longer than the actual string length

o The substring initial case of each letter (case not changed)

o The substring lower case of each character

o The substring upper case of each character

o The substring ASCII value of each character

o The substring Binary representation of each character

 Use the Integer wrapper class specifying the radix. Refer to the java docs for more info

o The substring Hex value of each character output in upper case

 Use the Integer wrapper class to convert to Hex

o Get entry for the next substring length (0 to quit)

 Subsequent substring lengths should use the same initial string (see example)

 Output “Thank you for playing!” when 0 is entered for the substring length

 Hints

o There is no need to convert case for non-letters although no points will be taken off if they are converted

o The ASCII, Binary, and Hex are based on the initial case entered

o Notice the binary values are padded with zeros on the left to make them the correct number of digits (8 for each character)

 A separate method would be best to accomplish this but is not required

Sample output is provided below. Be sure to mimic it exactly except for search value and random numbers.

Output of lower case characters correctly

5%

Output of upper case characters correctly

5%

Output of ASCII correctly

10%

Output of Binary correctly

10%

Output of Hex correctly

10%

Sample output is provided below. Be sure to mimic it exactly except for the string entered, substring length. The layout should be exact.

10%

NOTE: Complete your activity and submit it by clicking “Submit Assignment”

Total Percentage

100%

Sample Your output will vary based on input.

Notice the space didn’t print upper or lower. Notice the numbers were printed as normal for both upper and lower. Notice the “Thanks for playing!” when 0 is entered If the string raps, that is acceptable

  • 10 years ago
Assignment Completed
NOT RATED

Purchase the answer to view it

blurred-text
  • attachment
    lastinitialfirstinitialunit3ch12.zip