Customer Service Chat
Get quote & make Payment
Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION, Basic Computer Science
Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTIONS -- TO SEPARATE COMMA SEPARATE NUMBER VALUES AND THEN SUM TO TOTAL? I.E., USING SUBSTRING AND INDEXOF.
I''ve been trying to get this to work but am having problems with the loops and counters. Basically -- NOT using arrays or split functions -- I need to write a function that takes one string made of numbers separated by comma and then have the function return the total of all the separate numbers (number of entered comma separated values is fungible depending on how many values the user enters into the textbox). E.g., textbox1 string is: 10,11,12 --> Total =33. Or, 1,33,121,3,55 ---> Total = 213.
Below is my code so far. Thanks in advance!
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s, showVal As String
Dim Total, x, length As Integer
Dim comma1Position As Integer ''this is used to get the index of the first comma position
Dim oldcomma1Position As Integer ''dummy register variable
Dim commaCount As Integer = 0
s = TextBox1.Text
length = s.Length
x = 0
comma1Position = 0
oldcomma1Position = 0
commaCount = 0
Dim number As String
Total = 0
Do While x <> -1
oldcomma1Position = comma1Position
x = s.IndexOf(",")
comma1Position = s.IndexOf(",", (oldcomma1Position + 1))
number = s.Substring(oldcomma1Position, x)
Total = Total + CInt(number)
commaCount = commaCount + 1
showVal = " The Sum Total of the Comma Separated Values You Entered Is: " & Total
Posted Date: 11/15/2012 8:32:21 PM | Location : United States
Ask an Expert
Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION, Assignment Help, Ask Question on Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION, Get Answer, Expert's Help, Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION Discussions
Write discussion on Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION
Your posts are moderated
Write your message here..
Transaction-based model, Transaction-based model: Here, the pricing i...
Transaction-based model: Here, the pricing is based on providing a committed business service, for ex, processing payroll for a global company as part of HR offering and this
Idk, A rock weighs 33.6 N on Planet X and 49 N on Earth. What is g on Plane...
A rock weighs 33.6 N on Planet X and 49 N on Earth. What is g on Planet X
Negative Messages and Blog Related Assignment, Writing Assignment 1: You...
Writing Assignment 1: Your boss wants to know about the risks of corporate blogging and recommended policies to prevent companies from liability. Write a properly informal for
Assembly language, An example code on LDS
An example code on LDS
Reflex agent-artificial intelligence, Reflex agent-Artificial Intelligence ...
Reflex agent-Artificial Intelligence If an agent decides and executes an action in response to a sensor input without consultation of its world, then it may be considered a ref
Analyze the complexity of dijkstra''s algorithm, QUESTION (a) Given the...
QUESTION (a) Given the graph as shown in figure, apply Lagrangian technique to complete the table assuming μ=1 and T=14 Path P
Explain Process States and Process Control Block (PCB), Process States Thr...
Process States Throughout the lifespan of a process, its execution position may be in one of four states: (linked with each state is generally a queue on which the process resides)
Quantitative Methods in Business Decision Making, 4. Union City Al has dec...
4. Union City Al has decided to upgrade their tornado warning system. The city leaders have identified six potential locations for erecting a warning siren tower. They want to e
Info Systems Management, Assignment 1: Project Management and Information ...
Assignment 1: Project Management and Information Security 2-3 page paper in which you: 1. Explicate in detail the importance of project management as it relate to an informatio
Cai, What is CAI? Explain its pitfalls.
What is CAI? Explain its pitfalls.
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
IT Courses and Help
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Follow Us |
T & C
Copyright by ExpertsMind IT Educational Pvt. Ltd.