Need some help experts. I have a double number array, example:
{{1, 8}, {4, 5}, {7, 9}, {3, 1}, {9, 3}, {5, 9}, {8, 8}, {9, 9}, {7, 3}, {2, 1}, {5, 4}};
Using C#, what is a strategic way to display the frequencies of each numeric digit? I need to put the frequency numbers into textBoxes in a Visual Studio Form.
//Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace NumFrequency
{
public partial class Form1 : Form
{
List<int[]> list =
new List<int[]>();
List<int> array =
new List<int>();
char[] split_at = { ','
};
public Form1()
{
InitializeComponent();
}
private int
getTotalNums(string[] nums)
{
int i = 0;
int len = nums.Length;
int total = 0;
for(i = 0;i<len;i++)
{
try
{
Convert.ToInt32(nums[i]);
total++;
}
catch(Exception)
{
MessageBox.Show((nums[i].Equals("") ? "null character" : nums[i]) +
" is not a Integer");
}
}
return total;
}
private void
setNumbers(int[] numbers,string[] nums)
{
int i;
int len = nums.Length;
int pos = 0;
int num;
for(i = 0;i < len;i++)
{
try
{
num = Convert.ToInt32(nums[i]);
numbers[pos] = num;
array.Add(num);
pos++;
}
catch(Exception)
{
}
}
}
private void
getNumbers()
{
string[] nums = input.Text.Split(split_at,
StringSplitOptions.None);
int totalNums = getTotalNums(nums);
if(totalNums > 0)
{
int[] numbers = new int[totalNums];
setNumbers(numbers, nums);
list.Add(numbers);
}
else
{
MessageBox.Show("Number of integers given should be > 1");
}
input.Text = "";
}
private void
displayNumbers()
{
int i,j;
outputDisp.Text = "Displaying Double/more numbers entered:-
";
outputDisp.AppendText("{ ");
int len;
for(i = 0; i < list.Count; i++ )
{
outputDisp.AppendText(" { ");
len = list[i].Length;
for(j = 0;j < len;j++)
{
outputDisp.AppendText("" + list[i][j]);
if(j < len - 1)
{
outputDisp.AppendText(", ");
}
else
{
outputDisp.AppendText(" } ");
}
}
}
outputDisp.AppendText(" } ");
}
private void
calculateFrequency()
{
array.Sort();
int i;
int count = 1;
int num = array[0];
outputFreq.Text = "Displaying Frequency of each digit:- ";
for(i = 0;i < array.Count - 1 ;i++)
{
if(array[i] == array[i+1])
{
count++;
}
else
{
outputFreq.AppendText(" Frequency of " + num + " : " + count+"
");
num = array[i + 1];
count = 1;
}
}
outputFreq.AppendText(" Frequency of " + num + " : " + count + "
");
}
private void
addNum_Click(object sender, EventArgs e)
{
getNumbers();
}
private void
displayNum_Click(object sender, EventArgs e)
{
displayNumbers();
}
private void
calFrequency_Click(object sender, EventArgs e)
{
calculateFrequency();
}
}
}
//Form1.Designer.cs
namespace NumFrequency
{
partial class Form1
{
///
<summary>
/// Required designer
variable.
///
</summary>
private
System.ComponentModel.IContainer components = null;
///
<summary>
/// Clean up any
resources being used.
///
</summary>
/// <param
name="disposing">true if managed resources should be disposed;
otherwise, false.</param>
protected override void
Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
<summary>
/// Required method for
Designer support - do not modify
/// the contents of this
method with the code editor.
///
</summary>
private void
InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label1 = new System.Windows.Forms.Label();
this.input = new System.Windows.Forms.TextBox();
this.msg = new System.Windows.Forms.ToolTip(this.components);
this.addNum = new System.Windows.Forms.Button();
this.displayNum = new System.Windows.Forms.Button();
this.calFrequency = new System.Windows.Forms.Button();
this.outputFreq = new System.Windows.Forms.TextBox();
this.outputDisp = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(91, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(114, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Enter Double Numbers";
//
// input
//
this.input.Location = new System.Drawing.Point(211, 21);
this.input.Name = "input";
this.input.Size = new System.Drawing.Size(117, 20);
this.input.TabIndex = 1;
this.msg.SetToolTip(this.input, "Enter two or more numbers
separated by comma(,)");
//
// msg
//
this.msg.AutoPopDelay = 500;
this.msg.InitialDelay = 0;
this.msg.ReshowDelay = 100;
//
// addNum
//
this.addNum.Location = new System.Drawing.Point(334, 12);
this.addNum.Name = "addNum";
this.addNum.Size = new System.Drawing.Size(119, 37);
this.addNum.TabIndex = 2;
this.addNum.Text = "Add Numbers";
this.msg.SetToolTip(this.addNum, "Enter two or more numbers
separated by comma(,)");
this.addNum.UseVisualStyleBackColor = true;
this.addNum.Click += new
System.EventHandler(this.addNum_Click);
//
// displayNum
//
this.displayNum.Location = new System.Drawing.Point(156, 59);
this.displayNum.Name = "displayNum";
this.displayNum.Size = new System.Drawing.Size(117, 36);
this.displayNum.TabIndex = 3;
this.displayNum.Text = "Display Numbers";
this.msg.SetToolTip(this.displayNum, "Display array of numbers
entered");
this.displayNum.UseVisualStyleBackColor = true;
this.displayNum.Click += new
System.EventHandler(this.displayNum_Click);
//
// calFrequency
//
this.calFrequency.Location = new System.Drawing.Point(293,
59);
this.calFrequency.Name = "calFrequency";
this.calFrequency.Size = new System.Drawing.Size(113, 36);
this.calFrequency.TabIndex = 4;
this.calFrequency.Text = "Calculate Frequency";
this.msg.SetToolTip(this.calFrequency, "Calculate frequency of
numbers entered");
this.calFrequency.UseVisualStyleBackColor = true;
this.calFrequency.Click += new
System.EventHandler(this.calFrequency_Click);
//
// outputFreq
//
this.outputFreq.Location = new System.Drawing.Point(298,
126);
this.outputFreq.Multiline = true;
this.outputFreq.Name = "outputFreq";
this.outputFreq.ScrollBars =
System.Windows.Forms.ScrollBars.Both;
this.outputFreq.Size = new System.Drawing.Size(250, 181);
this.outputFreq.TabIndex = 5;
//
// outputDisp
//
this.outputDisp.Location = new System.Drawing.Point(12, 126);
this.outputDisp.Multiline = true;
this.outputDisp.Name = "outputDisp";
this.outputDisp.ScrollBars =
System.Windows.Forms.ScrollBars.Both;
this.outputDisp.Size = new System.Drawing.Size(250, 181);
this.outputDisp.TabIndex = 6;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(560, 319);
this.Controls.Add(this.outputDisp);
this.Controls.Add(this.outputFreq);
this.Controls.Add(this.calFrequency);
this.Controls.Add(this.displayNum);
this.Controls.Add(this.addNum);
this.Controls.Add(this.input);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Frequency Calculator";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private
System.Windows.Forms.Label label1;
private
System.Windows.Forms.TextBox input;
private
System.Windows.Forms.ToolTip msg;
private
System.Windows.Forms.Button addNum;
private
System.Windows.Forms.Button displayNum;
private
System.Windows.Forms.Button calFrequency;
private
System.Windows.Forms.TextBox outputFreq;
private
System.Windows.Forms.TextBox outputDisp;
}
}
//Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace NumFrequency
{
static class Program
{
///
<summary>
/// The main entry point
for the application.
///
</summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Need some help experts. I have a double number array, example: {{1, 8}, {4, 5}, {7,...
Need this in C Code is given below e Dots l lah dit Problem 1. (30 points) Fre bendord.cto obtain the free in decimal representation For ATY. this problem we complete the code in i tive long inte ens (W written the following positive long term 123, 40, 56, 7, 8, 9, 90, 900 the frequencies of all the digits are: 0:4, 1:1, 2:1, 3:1, 4:1, 5:1, 6:1, 7: 1. 8: 1.9: 3 In this example, the free ency of...
i need help writing these programs in c++ format 1. Enter two integer arrays: array1-129, 0, -56, 4, -7 and array2-19, 12, -36, -2, 12 3. Write the code to form and display another array array3 in which each element is the sum of numbers in the position in both arrays. Use pointers and functions: get array0. process arrays0 and show array0 (50 points) 2. Enter a positive 5-digit integer via the keyboard. Display each digit and fol- lowed by...
Need some help I am not understanding this programming class at all. We are using Microsoft visual studio with python in console mode to complete these labs. Double-click to hide white space CIS115 Week 4 Lab Overview Title of Lab: Multiplication Table in Python Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to...
HELLO EXPERTS, I need a code for this 4 questions.... it's make me crazy now... could you guys help me please? it's java Given two strings, word and a separator sep, return a big string made of count occurrences of the word, separated by the separator string. repeatSeparator("Word", "X", 3)- "WordXWordXWord" repeatSeparator("This", "And", 2)- "ThisAndThis" repeatSeparator("This", "And", 1)- "This"| For example: Result Test System.out.println(repeatSeparator("Pa", "Tn", 4)); PaTnPaTnPaTnPa Consider the series of numbers beginning at start and running up to but...
PLEASE HELP!!!I need help with the following JAVA PROGRAMS. Please ready carefully. So this comes from tony gaddis starting out with java book. I have included the screenshot of the problems for reference. I need HELP implementing these two problems TOGETHER. There should be TWO class files. One which has TWO methods (one to implement problem 8, and one to implement problem 9). The second class should consist of the MAIN program with the MAIN method which calls those methods....
I have questions declare of array several form. Question . Write array declarations for the following data: i) x = An array of 15 double type numbers ii) ? = [ 1 0 0 2 0 0 3 0 0] iii) word = 10 words of at most 9 characters each iv) Z = A 5 × 10 matrix of all zeroes THX! language is C
Excel was asked to generate 50 Poisson random numbers with mean λ = 5. x Frequency 0 1 1 1 2 4 3 7 4 7 5 8 6 10 7 3 8 3 9 4 10 1 11 1 (a) Calculate the sample mean. (Round your sample mean value to 2 decimal places.) Sample mean (b) Carry out the chi-square test at α = .05, combining end categories as needed to ensure that all expected frequencies are at least...
Hi I need some help in C programing class and I doing one of the exercise so that I can get better at coding. Suppose you are asked to design a software that helps an elementary school student learn multiplication and division of one-digit integer numbers. The software allows the student to select the arithmetic operation she or he wishes to study. The student chooses from a menu one of two arithmetic operations: 1) Multiplication and 2) Division (quotient). Based...
Radix sort C++ Come up with an unsorted array of numbers (integer array). Sort the numbers in ascending order and descending order and display them using radix sort. First sort in ascending, then reset the array to its original order and finally sort the array again in descending order. USE THIS STUCTURE struct nodeQ{ node *front; node *rear; }; nodeQ que[10]; enqueue(que[i],data); EXAMPLE: Original, unsorted list: [170, 45, 75, 90, 2, 802, 24, 66] 1ST PASS:...
Only part 1, makinf the 2nd and 3rd picture of code do the same thing using array Purpose This homework is to learn the concept and usage of one-dimensional (ID) arrays. Part 1 (30 pts) Modify your HW6' (i.e., digit frequency histogram) in a new program (DigitFrequencyArray.java) to use a count array instead of 10 count variables. Your new program should be much shorter than your original code since there is no need for branching statements (if or switch). For...