Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
Write the programme code using VB.Net that would keep on asking for 20 grade marks of students until the user enters -1.

The program should display the total of all the grade marks entered by the user and calculate the average.
Posted
Updated 5-Sep-10 21:29pm
v4
Comments
Sandeep Mewara 6-Sep-10 2:57am    
Reason for my vote of 1
No effort
Dalek Dave 6-Sep-10 3:29am    
Edited for Grammar and Readabillity.
CPallini 6-Sep-10 3:31am    
Reason for my vote of 1
Plain cut and paste of homework.
Smithers-Jones 6-Sep-10 5:22am    
Reason for my vote of 1
that's exactly the same "question", that user jasnita asked. Are you in the same class? Man, I'd love to tell your teacher about you two lazy bums.

Here is what is expected by enquirers:
1. TRY first what you want to do!
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.
 
Share this answer
 
I think you should start by reading a book on C++.
 
Share this answer
 
Comments
CPallini 6-Sep-10 3:36am    
While reading a good C++ book is always a great experience, I think a VB.NET one would be more appropriate for his task. -)
Abhinav S 6-Sep-10 5:26am    
Gah...he changed the tag. It was earlier a C++ question. Or have I been consuming too much alcohol? :)
This code demonstrates the WHILE loop, you'll have to figure out for yourself how to make it work for your particular assignment.

VB
Public Class Form1

    Private ableToProgram As Boolean = False

    Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles Button1.Click
        Dim grade As String
        Dim decision As String

        While Not ableToProgram
            decision = InputBox("Do you want to cheat? (Y/N)", _
                                "Learn to Program", "Y")
            If decision.ToUpper = "Y" Then
                grade = PostAssignmentOnForums()
            Else
                grade = DoWorkYourself()
            End If
            MsgBox(String.Format("You got an {0}", grade))
        End While

        MsgBox("Good Choice!")
    End Sub

    Function PostAssignmentOnForums() As String
        ableToProgram = False
        Return "F"
    End Function

    Function DoWorkYourself() As String
        ableToProgram = True
        Return "A"
    End Function

End Class
 
Share this answer
 
Comments
Peter_in_2780 7-Sep-10 19:39pm    
Reason for my vote of 5
Could you post this as a Tip/Trick? Then we could just post a link for similar homework questions! :)
Richard A. Dalton 8-Sep-10 3:32am    
Richard A. Dalton 8-Sep-10 3:33am    
Link didn't appear.

http://www.codeproject.com/Tips/108157/How-to-complete-your-programming-homework-assignme.aspx
This is obviously a course assignment.

Unless you do it you will not be able to pass and become a developer.

This site does not do homework.

We will help with specific problems, so get coding and come back with a specific question about a particular problem and people will be willing to help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900