Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
c#- why am i getting an error? I’ll add a picture of the error description
Week7 CS_WordCounter.Form1
Week7 CS WordCounter
public partial class Forml : Form
{
1 reference
public Form1()
{
: InitializeComponent();
19
20
21
B:
22
23
24
25
2 references
private int Numblords(string words)
{
// splits string when user inputs space
string[] wordCount = Nords.Split(' ');
return wordCount.Length;
26
27
28
29
30
31
32
1 reference
private double AvgCount(string words, int numlords)
{
int numLetters = GetwordCount (words);
double avglordCount = numLetters / numblords;
33
34
35
36
37
38
return avglordCount;
39
2 references
40
private int GetlordCount(string words)
{
string result = "";
foreach (char letter in words)
41
42
43
44
{
if (letter !='')
45
46
result += letter;
47
48
return result.Length;
49
50
51
1 reference
private void button1_Click(object sender, EventArgs e)
52
53
// only counts word and omits whitespace
string words = txtboxlords. Text. Trim();
int wordCount = Numlords (words);
54
55
56
57
double avgCount = AvgCount (words, wordCount);
58
59
MessageBox.Show("There are " + Numllords (words) +" words.", "The are " + GetwordCount(words)+ " letters, ");
60
61
1 reference
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
62
63
64
65
66
67
68
expand button
Transcribed Image Text:Week7 CS_WordCounter.Form1 Week7 CS WordCounter public partial class Forml : Form { 1 reference public Form1() { : InitializeComponent(); 19 20 21 B: 22 23 24 25 2 references private int Numblords(string words) { // splits string when user inputs space string[] wordCount = Nords.Split(' '); return wordCount.Length; 26 27 28 29 30 31 32 1 reference private double AvgCount(string words, int numlords) { int numLetters = GetwordCount (words); double avglordCount = numLetters / numblords; 33 34 35 36 37 38 return avglordCount; 39 2 references 40 private int GetlordCount(string words) { string result = ""; foreach (char letter in words) 41 42 43 44 { if (letter !='') 45 46 result += letter; 47 48 return result.Length; 49 50 51 1 reference private void button1_Click(object sender, EventArgs e) 52 53 // only counts word and omits whitespace string words = txtboxlords. Text. Trim(); int wordCount = Numlords (words); 54 55 56 57 double avgCount = AvgCount (words, wordCount); 58 59 MessageBox.Show("There are " + Numllords (words) +" words.", "The are " + GetwordCount(words)+ " letters, "); 60 61 1 reference private void btnExit_Click(object sender, EventArgs e) { this.Close(); 62 63 64 65 66 67 68
100 %
个-
Error List
Entire Solution
1 Error
Ao Warnings
O of 3 Messages
Build + IntelliSens
Code
Description
CS0161 'Form1.GetWordCount(string)': not all code paths return a value
Error List Data Tools Operations Output
O Ready
Type here to search
expand button
Transcribed Image Text:100 % 个- Error List Entire Solution 1 Error Ao Warnings O of 3 Messages Build + IntelliSens Code Description CS0161 'Form1.GetWordCount(string)': not all code paths return a value Error List Data Tools Operations Output O Ready Type here to search
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education