Write a method called Drawline that accepts as input an integer n and generates a line of output in lstOutput with n hyphens. That is, if n = 6 we have a line of ‘------‘ displayed in the list box.
Must be in C#
Dear Student ,
As per requirement submitted above kindly find below solution.
Here new windows forms application in C# is created using visual studio 2019 with name "SimpleCSharpApp". This application contains a form with name "Form1.cs".Below is the details of this form.
Form1.cs[Design] :
**********************************
Form1.cs :
//namespace
using System;
using System.Windows.Forms;
//application namespace
namespace SimpleCSharpApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Drawline button click
private void btnDrawLine_Click(object sender, EventArgs e)
{
//taking number entered by user
int number = int.Parse(txtNumber.Text);
//call method
this.Drawline(number);
}
//method to drawline
public void Drawline(int n)
{
string line = "";//declaring variable to generate line
//using for loop
for (int i = 0; i < n; i++)
{
//concatenate hypens
line = line + "-";
}
//show line in the listbox
lstOutput.Items.Add(line);
}
}
}
==================================
Output :Run application using F5 and will get the screen as shown below
Screen 1:Form1.cs
Screen 2:Screen showing line in the list box when a numnber with value 6 is entered
NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Write a method called Drawline that accepts as input an integer n and generates a line...
Request an integer n from the console. Write a function that accepts n as input and outputs the multiplication table of n from 1 to n to the console. Example Output (input in bold italics) Enter an integer: 9 1 * 9 = 9 2 * 9 = 18 3 * 9 = 27 4 * 9 = 36 5 * 9 = 45 6 * 9 = 54 7 * 9 = 63 8 * 9 = 72 9...
Write a method called inputStats that accepts a Scanner representing an input file and reports the number of lines, the longest line, the number of tokens on each line, and the length of the longest token on each line. If the file contains the following text: Beware the Jabberwock, my son, the jaws that bite, the claws that catch, Beware the JubJub bird and shun the frumious bandersnatch. For the input above, your method should produce the following output: Line...
Java problem In this problem, the first input is a positive integer called n that will represent the number of lines to process. The lines to be processed have one or more integers separated by whitespaces. For each of these lines, you must output: The minimum value of the integers The maximum value of the integers The sum of the integers It is worth to mention that the number of integers of each line is not known a priori and...
java /* Q2 (10 pts): Write a method called method that accepts an integer parameter * * * * and returns a sum of the first n terms of the sequence. * In other words, the method should generate the following sequence: 1 + 1/2 + 1/3 + 1/4 + ... 1/n * For example, method2(2) will return 1.5 since 1+1/2 = 1.5 * method2 (15) will return 3.3182289932289937 * You may assume that the parameter n is nonnegative. */...
In Java Write a method factorial that accepts an integer parameter n and that uses recursion to compute and return the value of n factorial (also known as n!). Your method should throw an IllegalArgumentException if n is negative. Several calls and their return values are shown below. Call Output factorial(0); 1 factorial(1); 1 factorial(3); 6 factorial(5); 120 factorial(10); 3628800 factorial(-4); IllegalArgumentException
in java In a class called DomainParser, write a method getTopLevelDomain that accepts a URL in String format then returns the top level domain. Files in the same directory: ComDemo.java Standard Input: google.com Required Output Enter a String\n Top level domain: com\n Standard Input google.co.in Required Output Enter a String\n Top level domain: in\n
java Write a program called Copy that accepts the names of an input file and an output file on the command line and copies the contents of the input file to the output file, for example, csc$ java Copy infile.txt outfile.txt
Write a program in Python that accepts as input an integer N and a real number c, and outputs the coefficient of the Nth degree term of the Taylor series for the function f(x) = ex centered at c. This process should recur until the user enters a quit code. Erroneous input should be excepted as necessary, and should result in a new prompt.
java Program Write a program called Copy that accepts the names of an input file and an output file on the command line and copies the contents of the input file to the output file, for example, csc$ java Copy infile.txt outfile.txt
Write a C program that accepts a single integer N. Your code must then calculate the average of all positive integers less than N that are divisible by either 5 or 7, but not both. When you print your average, truncate the result to three decimal places. Do not print anything else to the screen. Example input: 19 Example output: 10.200