GIDForums  

Go Back   GIDForums > Computer Programming Forums > .NET Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Nov-2005, 12:18
Saru Saru is offline
New Member
 
Join Date: Nov 2005
Posts: 13
Saru is on a distinguished road
Smile

Test Score Data


Am absolute new to the field.

I am getting started with this project. Can any one of you suggest the right simplest approach to get this done. I have not learned arrays yet. I kind of know that, one way to accomplish this project is using an array. But at this time i do not want to use an array.

so here is the project:

Test Score :Text Box User Entry
Num of Scores : LBL
Average Score : LBL
Best Score : LBL

EnterBtn ResetBtn ExitBtn

The use enters a test score ranging 0 to 100 and then clicks the enterBtn.
For each score the application adds one to the Num of Scores, Calculates the Average Score, and determines what the best score is so far. Then, it displays the results.

I know that the average score is the sum of all scores divided by the Num of Scores.

The specifications is:

To make this work, i had to declare module level variables for the Num of scores, the sum of the scores, and best score.

Pls advise the best simplest approach.
Thanks a bunch/Saru
  #2  
Old 01-Dec-2005, 04:22
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: Test Score Data


Hi Saru,

Welcome to the GID Forums™.

Do you use VB or C#?

If VB, You can find information and tutorial here:
Creating a Simple Application

Cheers,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #3  
Old 01-Dec-2005, 12:23
Saru Saru is offline
New Member
 
Join Date: Nov 2005
Posts: 13
Saru is on a distinguished road

Re: Test Score Data


Visualstudio.net
  #4  
Old 01-Dec-2005, 16:20
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: Test Score Data


Saru,
Visual Studio.NET supports a lot of languages.
For example, :C++, C#, JScript, Visual Basic, Transact-SQL, and Visual FoxPro etc, etc...

But, for your project, I think Visual Basic is the best possible solution.
Go to the link in my earlier post, and that will help you in creating a simple application.

Once you learn the basics right, then go on to complete the program.

You can also buy a good book, if you are serious in learning Visual Basic, or any other language.


Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #5  
Old 01-Dec-2005, 17:20
Saru Saru is offline
New Member
 
Join Date: Nov 2005
Posts: 13
Saru is on a distinguished road

Re: Test Score Data


Thanks for your response. I am using visual basic.
Can you tell how i would save the numbers in a variable and display the best score of all the numbers without using an array.
Thanks/Saru
  #6  
Old 01-Dec-2005, 18:29
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: Test Score Data


Yeah. You can do this program without arrays.

First, add one textbox to get the user input.
Create three buttons as you said, for submit, reset and cancel.
Now, the textbox name would be textbox1 by default.

After this, we have to create labels.
Labels are used to display text.
So, if you want to do like this:
Quote:
Originally Posted by saru
Test Score :Text Box User Entry
Num of Scores : LBL
Average Score : LBL
Best Score : LBL
you should create 7 labels, like this:
Code:
Label1 TextBox1 Label2 Label5 Label3 Label6 Label4 Label7 Button1 Button2 Button3
Now, you should alter the text displayed in the labels 1 2 3 and 4 accordingly.

The text in label5, label6 and 7 should be null.
Delete all the existing text in them.

Then also rename the button text, namely submit, reset and cancel.

So, the form has been created, and looks something like this:
Code:
Test Score : ________________ |_______________| Num of Scores : Average Score : Best Score : _____ _____ ______ Submit Reset Cancel

Now, the name of the buttons are:
submit, reset and cancel.
The name of the labels which contains:
number of scores ==> numlabel
average of scores ==> avglabel
best score ==> bestlabel


Now, to coding the inner details:

First, create a variable say score as integer.
Like this:
VB / Visual Basic Code:
Public score as Integer 
This is declared public because it can be used entirely in the project.
You also need to create four more variables, to calculate the number of scores, average score and best score, and a final one for total score.

And initialize all variables to 0 at start.
Like:
VB / Visual Basic Code:
score = 0

Then, go to the form, and double click the submit button.
It will go to a code, where it displays like this:
VB / Visual Basic Code:
Private Sub submit_Click()

End Sub

Now, you have get the text in the textbox, convert it to integer.
Like this:
VB / Visual Basic Code:
score = Convert.ToInt32(TextBox1.Text)

Now, add 1 to number of scores, and add score to total score.
To find the average, divide the total by the number of scores.
Then, check whether best score is leser than score.
If it is, then change the best score to score.
here is a sample:
VB / Visual Basic Code:
Private Sub submit_Click()

score = Convert.ToInt32(TextBox1.Text)
number = number + 1      'number is the number of scores
total = total + score       'total is the total of all scores
average = total / number ' average of all scores

If best < score Then
best = score
End If

End Sub

We have to add some more to the command1_click.
We have to change the text in the labels.
We can do like this:
VB / Visual Basic Code:
numlabel.text = number
avglabel.text = average
bestlabel.text = best

For reset, just assign all variables to zero.
Then clear the text in all labels.

For cancel, add the exit function.

Learn the basics before going into the program.
If you dont understand any of these things, post again to clarify.

Regards ,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #7  
Old 03-Dec-2005, 16:23
Saru Saru is offline
New Member
 
Join Date: Nov 2005
Posts: 13
Saru is on a distinguished road

Re: Test Score Data


Thank You very much Paramesh.
I was half way thru with trying to get the best score doing my way.
But your reply was a step by step walk thru. Let me tell you, you are a good teacher. It worked for me. Thank you so very much.

What part of india are you from? Are you in USA or in India?

Thanks Again,
Saru Brochu
  #8  
Old 03-Dec-2005, 20:11
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: Test Score Data


Thank You Saru!

I am in Chennai, Tamil Nadu, India.
Where are you from?


Best Regards,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #9  
Old 04-Dec-2005, 08:09
Saru Saru is offline
New Member
 
Join Date: Nov 2005
Posts: 13
Saru is on a distinguished road

Re: Test Score Data


Very Nice. I am in USA but I was born in Bangalore.
I am taking a job as .Net Developer entry level on Jan3rd 2006.
I might need help from you.

Here is my Direct email Address.
saru0516@yahoo.com

Thanks a lot for helping me.
Saru Brochu
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 13:12
Strange C++ code memory leakage problem gaoanyu C++ Forum 7 04-Nov-2005 08:09
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 07:10
[CONTEST?]Data Structure Test dsmith C Programming Language 2 06-Jun-2004 15:13

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 23:12.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.