[Show all top banners]

balbahadur
Replies to this thread:

More by balbahadur
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 NEED HELP IN VISUAL BASIC.NET "URGENT"
[VIEWED 4643 TIMES]
SAVE! for ease of future access.
Posted on 07-17-08 12:14 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Can sombody help me with my programming code in my Visual Basic Studio 2005.

Your help will be highly appreciated. Thank you in advance.

I am supposed to write a program to calculate the average of a series of Test score, where the lowest score in the series is dropped. I am supposed to use LOOP so a number of tests can be run without restarting your program. It should use the following functions:

-Find Lowest should determine which of the five scores is the lowest and return that value.

-calcAverage should Calculate and display the average of the four highest score.

 

 

 


 
Posted on 07-17-08 1:05 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Balbahadur,

try to be clear on your problem specification.. people in SAJHA might be expert programmers but they are not mind readers

Following is the C++ code.. Might be some VB Guru will show up and translate it for you.. The main thing here is finding the lowest score. Once lowest is found, you can easily calculate the average of the remaining scores i.e. calAverage()..

 

#include <iostream>
#include <iomanip>
using namespace std;

//Function Prototype
void getValues();
void findLowest( int testScore[], int sz );
void calcAverage();

int main()
{
    cout << "This program shows the full use of using functions ";
    cout << "to calculate the average of a series of tests.";

    getValues(); // The first function called
    // findLowest(); // This function is called second
    // calcAverage(); // Lastly, the third function is called

    cout << "Now, that is how you calculate the average of a ";
    cout << "series of tests.";

    return 0;
}

//**********************************************
// Definition of function getValues. *
// This function asks for five test scores and *
// stores them in variables. *
//**********************************************

void getValues()
{
    const int size = 5;
    int scores[size];

    cout << "Enter in " << size << " test scores and I will store ";
    cout << "them in variables.\n";

    for ( int i = 0; i < size; i++ )
    {
        cout << "Enter score " << ( i + 1 ) << " : ";
        cin >> scores[i];
    }

    findLowest( scores, size ); // pass the address and size of the scores array

    cout << fixed << showpoint << setprecision(2);
}

//**************************************************   *****
// Definition of function findLowest. *
// This function determines which out of those *
// five test scores is the lowest and return that value *
//**************************************************   *****

void findLowest( int testScore[], int sz )
{
    int lowest = testScore[0]; // make the first element of the array the lowest.
                               // loop through the array and compare the rest with
                               // first element.

    for ( int i = 0; i < sz; i++ )
    {
        if ( testScore[i] < lowest )
        {
            lowest = testScore[i];
        }
    }

    cout << "The lowest is " << lowest << endl;
}

//**************************************************   *****
// Definition of function calAverage. *
// This function determines the average of four highest test scores *
// and return that value * Balabahadur did this part of assignment himself

//**************************************************   *****

void calAverage( int testScore[], int sz )
    {

      //Calculate the average of 4 scores, you can left shift the sum two times to divide by 4.

      }


 
Posted on 07-17-08 11:34 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Is there any VisualBasic Pro who can translate that code to Visual basic?

 

Thanks in advance.


 
Posted on 07-17-08 11:39 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I think he also needs to repeat those calculations until the user says stop or something. Here's the pseudo code never mind the syntax:

unsigned char countinueLoop

while (continueLoop){
copy paste brain malfunctions "main" code here
ask the user if he wants to continue
if no continueLoop = false
}

if you dont want to ask the user before hand how many scores he/she wants to enter for a particular set, you can use the same method described above to get scores. when he/she says no, stop gathering more scores.

unless u absolutely have to use 2 functions there is a better way to do this. you could get the average and the lowest number in one loop. i assume you can not have a negative test score and the least u can score is a 0.

ask the user for n test scores and store it in an array called numberoftests.
i guess in vb u can use the .size or .length function to get its length
initialize variables during declaration just to make things simpler
lowest=0;
sum=0;
for i = 0; i<numberoftests.size;i++
    sum += numberoftests[i];
    if numberoftests[i]<lowest{lowest = numberoftests[i]}
next i
avr = (sum-lowest)/(numberoftests.size-1)
 
later.

 
Posted on 07-17-08 12:30 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Thanks Brainmalfunction and killEmAll for ur help.

    I am still not getting through this project. I do not exactly know how to translate that code to VB code. I got the concept though so working on it.

 


 
Posted on 07-17-08 1:15 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

yea there is no point in copy pasting the solution. ull never learn anything that way. if ur breakin ur head against the wall.. feeling helpless and overwhelmed.. ur headed in the right direction. have fun.

 
Posted on 07-17-08 1:35 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

haha kill exactly...balbahadur ji...what do u want us to tell u...like create new form , drag button, create inputbox etc etc in VB?

BM gave u the logic, just implement it...or atleast try to implement it. And then throw the code here if it gives you error , we can take a look at it, if you have done something wrong.

for your info..cout  ---> console Out..equivalent to print in VB i guess

                    cin---> console input ..equivalent to input in VB..(dang i forgot VB...)

Create the functions as BM has created...loops are similar

in C++

for ( int i = 0; i < sz; i++ )
in VB

for i=0 to sz-1

Oh yeah, put all these in loop so that it keeps repeating till the user stops it as Kill said.

Good luck....this should be the simplest task. I hope you are not computer major.

Last edited: 17-Jul-08 01:44 PM

 
Posted on 07-17-08 1:42 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 07-17-08 1:43 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 07-17-08 3:34 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

balbahadur , this is such a easy assignment...

if u dont know how to do it.. man u might want to reconsider ur major.

 
Posted on 07-18-08 10:26 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Thanks for your suggestion guys...I am not a computer major and unfortunately I took this class online. There are no examples in my textbook abt these codes and my professor wants mte to write 2 programs a week.

So I am having hardtime in this class. I wish I had a right book atleast with me which had enough example for me to figure out.


 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 60 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
Toilet paper or water?
ढ्याउ गर्दा दसैँको खसी गनाउच
Tourist Visa - Seeking Suggestions and Guidance
To Sajha admin
From Trump “I will revoke TPS, and deport them back to their country.”
I hope all the fake Nepali refugee get deported
wanna be ruled by stupid or an Idiot ?
MAGA denaturalization proposal!!
advanced parole
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
How to Retrieve a Copy of Domestic Violence Complaint???
Travel Document for TPS (approved)
All the Qatar ailines from Nepal canceled to USA
MAGA and all how do you feel about Trumps cabinet pick?
Those who are in TPS, what’s your backup plan?
MAGA मार्का कुरा पढेर दिमाग नखपाउनुस !
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters