Question: ///////Help with Java ////// Write a program that gets input for a string, then output a substring of this string character by character showing the

///////Help with Java //////

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.

Using

*Integer Types and Floating Point Types

*Char Type and ASCII Character Set

*Type Conversions

*Prefix/Postfix Modes for Increment/Decrement

*For loop header detail

*Hexadecimal, Octal, and Binary Numbers

Get input for a string containing both numbers and letters of any length Get input for a substring length (0 to quit) Use a for loop with postfix notation to increment through the string 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 initial digit/character o The ASCII value of each character o The ASCII value of each integer converted to a string Notice the columns for the char/int Hint: isdigit would work great for this. o The Hex value of each integer/character output in upper case Use the Integer wrapper class to convert to Hex Output Thank you for playing!

////////////////////////////////////////////////////////

output result

///////Help with Java ////// Write a program that gets input for a

////////////////////////////////////////

This is the code I am working with but it's the first week learning about it so Im really bad at this.

////////////////////////////////////////

import java.util.*;

public class AsciiWork { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String input; // input for string of any length char ch; // ascii associated character int ascii; // ascii value of character System.out.println("Please enter a string of any length: "); input = scan.next(); // scanner input System.out.println("Initial\tASCII\tASCII\tHex"); for (int i = 0; i ascii) ? input : ascii) //ternary operator, not sure if using it right but required { System.out.print(. /ot sure how to get output for results here } } System.out.print("Thank you for playing!"); } } // end

Comments included would be greatly appreciated.

Please enter a string of any length: Ken123 Initial ASCII char ASCII int Hex 4B 101 65 6E 110 49 31 32 50 51 33 Thank you for playing

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!