Learning Goal: I’m working on a java multi-part question and need an explanation and answer to help me learn.
ASSIGNMENT NO. 1 ( LAB#5 )
A. Write code to generate a random character between 48 and 122 (inclusive). You can do this by first generating an integer value between 48 and 122 and then cast it as a char. Do this in a loop 100 times, concatenating each character to a String as each character is generated. When the loop completes, the string will contain 100 characters. Print the string of 100 characters.
Remember that to generate a random number between a start and end value, the formula is:
(int)(start + Math.random()*(end-start+1))
Loop through the string you just created, character by character using charAt(i), to count and print the following:
————————————————————————————————————————————————————————————————-
B. Write a program that prompts the user to enter an enhanced Social Security number as a string in the format DDD-DD-DDDX where D is a digit from 0 to 9. The rightmost character, X, is legal if it’s between 0 and 9 or between A to Z.
The program should check whether the input is valid and in the correct format. There’s a dash after the first 3 digits and after the second group of 2 digits.
If an input is invalid, print the input and the position in the string (starting from position 0) where the error occurred.
If the input is valid, print a message that the Social Security number is valid.
Continue to ask for the next Social Security number but stop when a string of length 1 is entered.
Test cases
ABC
123-A8-1234
12-345-6789
12345-6789
123-45-678A
123-45-678AB
A
ASSIGNMENT NO. 2 ( HW#5 )
Homework 5 CISC 1115 TR11
Your Java program will be reading input from a file name strInput.txt. Each record contains
String firstname
String lastName
String strSalary (which will be converted to a double if it’s valid – see below)
char status
String cityState (city and state and combine together but separated by a comma)
Sample input:
Ira Rudowsky 87654.32 F Brooklyn,NY
Jane Doe 987609.87 F NY,NY
Mickey Mantle 345678.30 D Orlando,FL
Fran Young 10456.82 G Boston,MA
Richard Clark 67890.32 D Washington,DC
Jack Smith 23489A.82 D Houston,TX
Serena Williams 1295609.87 D Denver,CO
Read from the file one record at a time and process as follows:
SPECIAL INSTRUCTION : 2 SEPARATE SPECIFIC FILE ACCORDING TO THE ASSIGNMENT NAME AND HW OR LAB NUMBER. MAKE 3 DIFFERENT FILE FOR 2 DIFFERENT JAVA PROGRAMMING ASSIGNMENT I EXPLAINED. YOU HAVE TO SHOW PICTURE OF YOUR CODING PROGRAM . YOU HAVE TO ADD THE CODING PICTURES. Write a complete Java program, including comments in both the main program and in each method. YOU HAVE TO USE ECLIPSE JAVA IDE
EXPLAIN ALL THE ANSWERS AND I need the whole assignment programming code in google docs. Just copy the code and paste it on google docs and full program from your Java IDE. I need all the answers and all the java code clearly in Java IDE and Google DOCS and I need the answer of the all the questions from the assignment fully cleared. The code have to be perfectly run without any error. And explain everything with answers.”!!!
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments