TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
William Langly
NA
32
5.2k
Program Problems
Oct 26 2017 1:33 PM
I am trying to a GUI application that allows a user to enter a student’s number of words typed.
Make sure the user's input is valid, otherwise prompt them to correct their mistake using
a MessageBox. The output is the letter grade earned by the student. The design of the
application's interface is up to you. You must use parallel arrays and range matching
(not simply a series of if/else if statements). Here is what i have so far:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Lab_6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int numOfWords;
int[] gradeRangeLowLimits = { 0, 16, 31, 51, 76 };
char[] grades = { 'F', 'D', 'C', 'B', 'A' };
bool found = false;
double badInput = 0;
numOfWords = int.Parse(textBox1.Text);
int index = gradeRangeLowLimits.Length - 1;
while (index >= 0 && !found)
{
if (numOfWords >= gradeRangeLowLimits[index])
found = true;
else
--index;
}
if (found)
badInput = grades[index];
MessageBox.Show("Invalid. Please enter another value.");
}
}
}
Reply
Answers (
5
)
how to create setup file in visual Studio 2010
vb.net 2010 edit