Create a new java application called patternmaker and


Question 1. Create a new Java application called "PatternMaker" (without the quotation marks) according to the following guidelines.

The program prompts the user for five input values:

1. An integer value between 1 and 10 (inclusive) for the number of rows to be printed
2. A second integer value between 1 and 10 (inclusive) for the number of columns to be printed
3. A string value for the starting string of the pattern
4. A string value for the second string of the pattern
5. A string value that separates the first two strings
The program must use nested for loops to print a rectangular array of alternating first and second strings of the pattern, separated by the separator string and such that the first string in the first row uses the "first string" provided by the user, but each subsequent row alternates the starting string between the "second string" the user provided and the "first string" the user provided.

So, for instance, if the user enters 5 for the number of rows, 7 for the number of columns, and "XX" for the first string, "OO" for the second string, and "***" for the separator, your program should print the following rectangular pattern.
XX***OO***XX***OO***XX***OO***XX
OO***XX***OO***XX***OO***XX***OO
XX***OO***XX***OO***XX***OO***XX
OO***XX***OO***XX***OO***XX***OO
XX***OO***XX***OO***XX***OO***XX
- Note the requirement for this program to use nested for loops (Horstmann section 4.3).
- Note that there is no delimiter at the end of the lines.
- The logic needed for the nested for loops is a bit tricky. Try writing out the logic for simple cases (e.g., 2 rows and 3 columns).

Question 2. Create a new Java application called "AtmSimDoLoop" (without the quotation marks) that simulates a simple ATM according to the following guidelines.

The program should start with an initial account balance, which you can set to any legitimate double value. All output of currency values should include a leading dollar sign and use two decimal positions. Prompt the user with the following prompt (without the dashed lines) using a do loop.
________________________________________
Enter the number of your desired transaction type.
1. Balance
2. Deposit
3. Withdrawal
4. Quit
________________________________________
- If a balance is requested, the program should output "Your current balance is $X.XX" where X.XX is the initial balance, and then re-display the prompt and await the next transaction type.
- If a deposit is requested, prompt the user to enter the amount of the deposit (use a double for this). Add the deposit amount to the initial balance and then print "Your current balance is $X.XX" where X.XX is the new balance after the deposit, and then re-display the prompt and await the next transaction type.
- If a withdrawal is requested, prompt the user to enter the amount of the withdrawal (use a double for this). If the proposed withdrawal amount is less than or equal to the initial balance, print "Your current balance is $X.XX" where X.XX is the new balance after the withdrawal, and then re-display the prompt and await the next transaction type. If the proposed withdrawal amount exceeds the initial balance, print "Insufficient funds. Your current balance is $X.XX" where X.XX is the initial balance, and then re-display the prompt and await the next transaction type.

If "Quit" is requested, the program should print "Good-bye" and then stop.

Note that you need to keep track of the current balance during each iteration of the loop.

Question 3.

Create a new Java application called "MultiTable" (without the quotation marks) that uses nested for loops to print a multiplication table as shown below.

The value of each cell should be computed using the values in the row and column headings (e.g., 1 * 1; 1 * 2; 1 * 3; etc.).
Make sure to match the below results as shown.
* | 1 2 3 4 5 6 7 8 9
-------------------------------
1 | 1 2 3 4 5 6 7 8 9
2 | 2 4 6 8 10 12 14 16 18
3 | 3 6 9 12 15 18 21 24 27
4 | 4 8 12 16 20 24 28 32 36
5 | 5 10 15 20 25 30 35 40 45
6 | 6 12 18 24 30 36 42 48 54
7 | 7 14 21 28 35 42 49 56 63
8 | 8 16 24 32 40 48 56 64 72
9 | 9 18 27 36 45 54 63 72 81

Question 4.

Create a new Java application called "CharCounter" (without the quotation marks) that gets two Strings called inputEntry and inputCharacter from the user at the command line. Allow for the inputEntry String to be one or more words of input. Check that the inputCharacter String has a length of 1 and note these validations:

- If it doesn't, provide the user with suitable feedback and conclude the program.
- If the inputCharacter length is valid (i.e., it has a length of 1), use a while loop to check each position in the inputEntry variable and return the number of times the character occurs. For example, if the inputEntry is "test" and the inputCharacter is "e" you would output: "There is 1 occurrence(s) of 'e' in test."

Question 5.

Create a new Java application called "Averager" (without the quotation marks) to get positive (i.e., any number greater than 0), double numbers from the user at the command line until they enter -1 (the sentinel). Use a do-while loop. Compute the average of the series of numbers and print the average to the command line. Don't include the sentinel in calculation of the average. Include suitable data validations for invalid data (e.g. the user enters a letter instead of a number), but stay in the loop until the sentinel is entered.

Question 6.

Create a new Java application called "Rooter" (without the quotation marks) to get a positive integer (i.e. any number greater than 0) called "start" from the user at the command line and then find the square root of every number from "start" down through 0. Use a while loop to count down. As an example, if the user entered 8, you would find the square root of 8, then the square root of 7, and so on.

Print each square root on a separate line. Include data validation to ensure the user provides a positive integer. If the validation is not passed, provide the user with suitable feedback and stay in the program to let the user try again until valid input is received. Use the Math.sqrt(double a) method to find each square root and output the integer and four decimal positions.

Question 7.

Create a new Java application called "EvenThough" (without the quotation marks) that uses a while loop to check the integers 1 through 20 and prints only those integers that are even.

Use division to determine an even integer (i.e., when divided by 2 the result yields no remainder).

All output should appear on a single line, but separate each even integer with a comma and a space. Be sure the integer 20 (which is the last expected number you'll output) omits the trailing comma and space.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create a new java application called patternmaker and
Reference No:- TGS02674681

Now Priced at $70 (50% Discount)

Recommended (99%)

Rated (4.3/5)