(c) [5 points] Complete the missing parts of the following program to print a triangular pattern...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(c) [5 points] Complete the missing parts of the following program to print a triangular pattern of n rows with every mth with an alphabet. The alphabet starts from 'A', then 'B', then 'C', etc. until 'Z'. When we reach 'Z', we start from 'A' again. For example, n = 5, m = 3 would print the following on screen. * *A **B *D**E Hint: The ASCII code of 'A' through 'Z' are 65 through 90. import java.util.Scanner; public class PrintTriangle { public static void main(String args) { Scanner acne Scanner(System.in); System.out.print("Enter n and m: "); int a = sc.nextInt (); int m=sc.next IntO; sc.closeO; int counter = 0; char ch= 'A'; for(int i=1;i / Part in */) ch = 'A': System.out.print(ch); / Part } else System.out.print("*"); System.out.println 0; (c) [5 points] Complete the missing parts of the following program to print a triangular pattern of n rows with every mth with an alphabet. The alphabet starts from 'A', then 'B', then 'C', etc. until 'Z'. When we reach 'Z', we start from 'A' again. For example, n = 5, m = 3 would print the following on screen. * *A **B *D**E Hint: The ASCII code of 'A' through 'Z' are 65 through 90. import java.util.Scanner; public class PrintTriangle { public static void main(String args) { Scanner acne Scanner(System.in); System.out.print("Enter n and m: "); int a = sc.nextInt (); int m=sc.next IntO; sc.closeO; int counter = 0; char ch= 'A'; for(int i=1;i / Part in */) ch = 'A': System.out.print(ch); / Part } else System.out.print("*"); System.out.println 0;
Expert Answer:
Answer rating: 100% (QA)
Heres the completed program import javautilScanner public class PrintTria... View the full answer
Related Book For
Business Statistics A Decision Making Approach
ISBN: 9780133021844
9th Edition
Authors: David F. Groebner, Patrick W. Shannon, Phillip C. Fry
Posted Date:
Students also viewed these programming questions
-
Briefly describe ASCII and Unicode and draw attention to any relationship between them. [3 marks] (b) Briefly explain what a Reader is in the context of reading characters from data. [3 marks] A...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Do the following problems mentally using the distributive property. a. 5 99 b. 4 88 c. 8 52
-
The data set has mean 10 and standard deviation 3. Fill in the following blanks: a. Approximately 68% of the observations lie between ______ and ______. b. Approximately 95% of the observations lie...
-
Which type of WAN connection would provide high-speed, dedicated bandwidth between two sites?
-
A viscous oil with a specific gravity \(S G=0.85\) and a viscosity of \(0.10 \mathrm{~Pa} \cdot \mathrm{s}\) flows from tank \(A\) to \(\operatorname{tank} B\) through the six rectangular slots...
-
A producer of picture frames uses a tracking signal with limits of ±4 to decide whether a forecast should be reviewed. Given historical information for the past four weeks, compute the...
-
An air conditioner with cooling capacity of 7 . 3 5 kW consumes 1 . 4 7 kW of electricity during operation. The air conditioner is used to maintain the temperature of a room at 2 0 \ deg C during the...
-
In the figure for Problem 13-35, pinion 2 is to be a right-hand helical gear having a helix angle of 30, a normal pressure angle of 20, 16 teeth, and a normal diametral pitch of 6 teeth/in. A motor...
-
Zack Manufacturing Company makes a product that is processed through two departments: cutting and final. All materials are added in the first department. During the month of March 2019, the company...
-
What is wrong with the following code? public class Charge { } private double rx, ry; private double q; public Charge (double x0, double y0, double q0) { } double rx = x0; double ry y0; double q =...
-
Write a static method isValidDNA() that takes a string as its argument and returns true if and only if it is composed entirely of the characters A, T, C, and G.
-
Write a function complementWatsonCrick() that takes a DNA string as its argument and returns its Watson-Crick complement: replace A with T, C with G, and vice versa.
-
Write a program LongestPalindromic-Subsequence that takes a string as a command-line argument and determines the longest subsequence of the string that is a palindrome (the same when read forward or...
-
Write a program that takes as command-line arguments the name of an image file and the pixel coordinates of a rectangle within the image; reads from standard input a list of Color values (represented...
-
Briefly answer the following: 1. Consider the Ben Ten character and his transformation into different Aliens, briefly discuss which OOP pillar may implement over this character. 2. Inheritance is...
-
Graph the following conic sections, labeling vertices, foci, directrices, and asymptotes (if they exist). Give the eccentricity of the curve. Use a graphing utility to check your work. 10 5 + 2 cos 0
-
According to a September 2005 article on the Womensenews.org Web site, Caesarean sections, in which a baby is delivered by abdominal surgery, have increased fivefold in the past 30 years, prompting...
-
Based on the sample data in the following frequency distribution, conduct a test to determine whether the population from which the sample data were selected is Poisson distributed with mean equal to...
-
The managing partner for Westwood One Investment Managers, Inc., gave a public seminar in which she discussed a number of issues, including investment risk analysis. In that seminar, she reminded...
-
The Current Better Life Survey (https://www.oecdbetterlifeindex.org) is used by the Organization for Economic Co-operation and Development (OECD) to assign Better Life Indices, calculated through...
-
During the spring semester in 2014, an ebook survey was administered to students at Winthrop University. Of the 170 students sampled, 45% indicated that they had used ebooks for their academic work....
-
Suppose a student is interested in knowing the preferred holiday destinations of the faculty members in their university. They are affiliated to the college of business and interview a few of the...
Study smarter with the SolutionInn App