Hi, i really need help making this program:

Write a program that will ask a teacher to enter his 4 digit password. The program gives three tries for the password. If the teacher fails in three tries, the program displays the message, “you are not eligible to enter the grades”. If the password is correct, enter "the names of the students", "ID" and "percentage of marks in physics.
All together there are 10 students. Alternately the teacher may be promted to enter any number of students interactively. the program then sorts the names alphabetically. the program calculates the class average physics. the program assigns the letter grades to each student according to the following criterion.

- >90 and <=100 A
- >80 and <=90 B
- >70 and <=80 C
- >60 and <=70 D
- <60 F

The program displays the following for all 10 students.

1. Name, ID, % marks, and the letter grade for each students.
2. No. of students in each grade
3. Highest marks, lowest marks and average (up to two decimal places) marks.

The program saves the following data as a sequential file on my D:\ drive

a) Name
b) ID
c) Marks
d) Letter Grade.

with a click of a command button, the file can be displayed on a picture box.

Dani AI

Generated

This thread concerns a small Visual Basic application to accept teacher input, compute letter grades and class statistics, save records to disk, and display the saved file. posted the original request; noted having implemented the program but did not post the source. The notes below provide a practical, implementation-focused blueprint, common pitfalls, and compact VB patterns that match typical Windows Forms/VB.NET workflows (adaptable to older VB with small changes).

Keep the model simple: a Student class/Structure with Name, ID, Marks (Double) and Grade (String). Collect entries into a List(Of Student); validate each field (trim names, require non-empty name/ID, use Double.TryParse for marks and enforce 0-100). Implement the password check with a short retry loop (stop after the allowed attempts). Sort names case-insensitively (List.Sort with a comparer or LINQ OrderBy with StringComparer). Compute highest, lowest and average using Max/Min/Average and format the average to two decimals (Math.Round or ToString("F2")). Count students per letter grade with simple counters or GroupBy.

Key code patterns (VB.NET):

Function GetLetterGrade(mark As Double) As String
    If mark > 90 And mark <= 100 Then Return "A"
    If mark > 80 And mark <= 90 Then Return "B"
    If mark > 70 And mark <= 80 Then Return "C"
    If mark > 60 And mark <= 70 Then Return "D"
    Return "F"
End Function

Save as a simple CSV and display:

Using sw As New IO.StreamWriter("D:\students.txt", False)
    For Each s In students
        sw.WriteLine(String.Join(",", s.Name, s.ID, s.Marks.ToString("F2"), s.Grade))
    Next
End Using

To show text in a PictureBox draw the file onto a Bitmap with Graphics.DrawString; however, a multiline TextBox or ListBox is easier for text display and scrolling.

Cautions: handle IO exceptions (drive D: may be missing or write-protected), avoid hard-coding sensitive passwords, and guard against an empty student list before computing stats. These points complement 's note and address the typical edge cases that commonly cause runtime errors.

Recommended Answers

All 5 Replies

Write a program that will ask ..........

I have written the programme. :)
What next ?

I have written the programme. :)
What next ?

Can you send it to me please ?

No.

I did not open a free code writing shop.

You need to show some effort to get any help here.

No.

I did not open a free code writing shop.

You need to show some effort to get any help here.

Look, i'm in a real pinch right now so if you cant help stop wasting my time.

commented: this is for your bad attitude. -3

What i was trying to explain you is you need to show us here what you have done so far and where you are struck. We need to understand what exactly is the problem to slove it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.