[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 3921 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 90 days
Recommended Popular Threads Controvertial Threads
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
TPS Re-registration case still pending ..
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
Nas and The Bokas: Coming to a Night Club near you
मन भित्र को पत्रै पत्र!
Will MAGA really start shooting people?
TPS Work Permit/How long your took?
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
Breathe in. Breathe out.
3 most corrupt politicians in the world
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
चितवनको होस्टलमा १३ वर्षीया शालिन पोखरेल झुण्डिएको अवस्था - बलात्कार पछि हत्याको शंका - होस्टेलहरु असुरक्षित
शीर्षक जे पनि हुन सक्छ।
Disinformation for profit - scammers cash in on conspiracy theories
someone please tell me TPS is here to stay :(
They are openly permitting undocumented immigrants to participate in federal elections in Arizona now.
Nas and The Bokas: Coming to a Night Club near you
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