thanks for the question, here is the full java class with screenshot
======================================================================================
package bank; import java.util.Scanner; public class Diamond { public static void printNChars(int n, char c){ for(int i=1; i<=n;i++) System.out.print(c); } public static void printDiamond(int size, char edgeChar, char fillChar){ int topHeight= size/2; for(int row=0;row<=topHeight;row++){ printNChars(size-row,' '); System.out.print(edgeChar); printNChars(2*row-1,fillChar); if(row!=0) System.out.println(edgeChar); else System.out.println(); } for(int row=topHeight;row>=0;row--){ printNChars(size-row,' '); System.out.print(edgeChar); printNChars(2*row-1,fillChar); if (row!=0) System.out.println(edgeChar); } } public static void printDiamond(Scanner scnr){ int size=0; while (size<1 || size>80){ System.out.print("Enter size (limit 1-80): "); size=scnr.nextInt(); } scnr.nextLine(); System.out.print("Enter edge character: "); char edge = scnr.nextLine().charAt(0); System.out.print("Enter fill character: "); char fill = scnr.nextLine().charAt(0); printDiamond(size,edge,fill); } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); printDiamond(scanner); } }
======================================================================================
How can i print a diamond implementing these methods public static void printNChars(int n, char c))....
Hello Guys. I need help with this its in java In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide...
Hello, I need help writing the two methods to print a triangle shape in java. An example of the shape is as follows: 9 8 7 6 5 4 3 8 7 6 5 4 3 7 6 5 4 3 6 5 4 3 5 4 3 4 3 3 One method should be defined as "public static void printPattern(int num1, int num2, Boolean ascending)". This method will print a upper-triangle matrix-like layout filled will a sequence of integers...
Write a Java method . public static boolean upChecker(char [][] wordSearch, String word, int row, int col) This method does the following: compare the first character from word to the character in puzzle[row][col] if they match subtract one from row (to check the previous character in the same column) and continue comparing characters, by advancing to the next character in word else if puzzle[row][col] is NOT part of puzzle array or the character in the cell does not match the...
Given the following classes: StringTools.java: public class StringTools { public static String reverse(String s){ char[] original=s.toCharArray(); char[] reverse = new char[original.length]; for(int i =0; i<s.length(); i++){ reverse[i] = original[original.length-1-i]; } return new String(reverse); } /** * Takes in a string containing a first, middle and last name in that order. * For example Amith Mamidi Reddy to A. M. Reddy. * If there are not three words in the string then the method will return null * @param name in...
Consider the following methods’ headers: public static int one(int a, char b, double c, String d) public static double two(double x, double y) public static char three(int r, int s, char t, double u) Answer the following questions: Q1) What is the signature of method one? Answer: Q2) What is the return type of method two? Answer: Q3) What the formal parameters of method three? Answer: Q4) How many actual parameters are needed to call the method three? Answer: Q5)...
import java.util.Scanner; public class Lab6d { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); // TODO: get user choice // TODO: call printTable method passing choice as the parameter } public static void printTable(int stop) { // TODO: print header // TODO: loop to print table rows up to stop value } Write a Java program where the main () method prompts the user to select an integer value between 1 and...
Show the analytical time complexity. Show all work. public static void foo(int n, char A, char B, char C) { if (n<=0) return; // primitive operation foo(n-2, A, C, B); for (int i=0; i<n; i++) System.out.println(“n=” + n); // primitive operation foo(n-2, B, A, C); }
Question 1: * - Print out the welcome message: "Welcome to this choose your own adventure system!" * - Begin the play again loop: * - Prompt for a filename using the promptString method with the prompt: * "Please enter the story filename: " * - Prompt for a char using the promptChar method with the prompt: * "Do you want to try again? " * - Repeat until the character returned by...
Step 2: Create the method specified below. static int GetValidWidth(string prompt) Input parameters prompt: message for user describing the input required Returns A non-zero width entered by the user Step 3: Create the method specified below. static int GetValidHeight(string prompt) Input parameters prompt: message for user describing the input required Returns A non-zero positive height entered by the user Step 4: Create the method specified below. static void DisplayBox(int width, int height, char fillChar) Input parameters width: width of each...
This is Crypto Manager blank public class CryptoManager { private static final char LOWER_BOUND = ' '; private static final char UPPER_BOUND = '_'; private static final int RANGE = UPPER_BOUND - LOWER_BOUND + 1; /** * This method determines if a string is within the allowable bounds of ASCII codes * according to the LOWER_BOUND and UPPER_BOUND characters * @param plainText a string to be encrypted, if it is within the allowable bounds * @return true if all characters...