SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 314 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 21 Dec 2017 My Price 10.00

provided Textboxes and check the Checkbox

I need help with this program. Complete program to do.

Due: Tues. 04/17/17, 11:50 PM                                24 Points

 

Objectives:

                    Checkbox control

                    Saving to the text file

                    Reading from a text file

                    Form Closing Event Method

                    Form_Load event method

 

Problem Description:Design a C# project to store up to 100 students’ information in parallel arrays. The user will enter each student’s name, score in provided Textboxes and check the Checkbox if student is a CIT major, followed by a click on the Enter button to store the student in the parallel arrays.

 

                                              Figure 1 - Screen capture when Display is clicked

Class Scope Declarations:

-          Declare a named constant to store size of the parallel arrays= 100.

-          Declare 3 parallel arrays to store up to 100 students’ names, scores and CIT major (true / false). Use the named constant at declaration.

-          Declare a counter to keep track of the next available index in the array.

-          Declare a variable to store the file name with the full path:

Private String mFileName = Path.Combine (Application.StartupPath , “Students.txt”);

 

 Enter Button (pseudo-code)

 

Ø  Validate the user’s input - Call the helper method.

Ø  If data is not valid - return.

Ø  Storethe entereddata in parallel arrays.

o   If the check box is checked, store true in the array, otherwise store false.

Ø  If array is full

o   Inform the user

o   Disable the Enter button.

Ø  Call the helper method  to clear the input.

 

     Display Button:

Ø  Inform the user if array is empty, and return.

Ø  Display all the names, scores and CIT major (true / false) in the Listbox.

 

Stats Button:

Ø  Inform the user if array is empty, and return.

Ø  Clear the Listbox

Ø  Display number of students entered.

Ø  Display number of CIT students entered.

Ø  Compute the average. Display it with proper format.

 

Clear Button:

Ø  Call ClearInput() to clear the entered input.

Ø   Clear the Listbox.

 

Exit Button: End program execution.

 

FormClosing Event:

Save data stored in parallel arrays to a text file named students.txt, one student per line, with tab delimited fields. Refer to Figure-3.

Ø  Declare an object variable of type StreamWriter.

Ø  Open the file students.txt at the same location as your project’s .exe

Ø  Write a loop to write each student’s data on a separate line, tab delimited.

Ø  Close the file.

 

Helper Methods:

 

1)      ValidateInput(): 

a.       Input: none

b.      Output data type: bool

c.       Task: Validate user’s input based on the following rules:

- Existence check on name.

- Score must be a whole number.

- Valid range for score is 0 to 100, both inclusive.

 

2)      ClearInput ( )

a.       Input: none

b.      Output: void

c.       Task: Clear the entered data and set the focus to the top textbox.

Call this method at the end of the Enter button and from the Clear button.

 

3)      DisplayMessage( )

a.       Input: String

b.      Output data type: void

c.       Task:Display the input string using MessageBox.Show(). The Messagebox should include all 4 arguments.

 

 

FormClosing Event Method

     Save content of the parallel arrays to the text file in this event procedure.

 

Ø  Confirm with the user whether to end the program execution or not.

o   Use MessageBox.Show to ask this question. Provide buttons Yes and No in the Messagebox plus the Question icon.

o   If the user’s  answer is NO,

§  Cancel the closing event.

§  Return.

Ø  Save data stored in parallel arrays to a text file.   

o   Declare an object variable of StreamWriter class.Open the file (use class scope filename) to write to.

o   Write a loop to write each student’s data to the file in a tab delimited format.

o   Close the file.

Ø  Include Exception Handling code to handle exceptions (try – catch - finally).

 

 

                                                                       Figure 22 - An image of the text file

 

Form_Load Event Method  

 

Upload / read data from a text file into the programin parallel arrays in this event method.

Ø  Check if the file exists (Use the class scope filename).

o   If file does not exist, return.

Ø  Declare an Object variable of StreamReader class andopen the file mFilename for reading.

Ø  Declare a string  variable to store a line read from the file.

Ø  Write a loop to read until end of the file.

o   Read a line into the string variable.

o   Split the line to extract pieces of data.

o   Store pieces of data in parallel arrays at mIndex. -

Ø  Close the file.

Ø  Include Exception Handling code to handle exceptions (try – catch - finally).

 

 

Grading chart:

Points

Criteria

 

Intro comments (-1 if missing)

1

mFilename declaration with class scope   (code is given)

 

ValidateInput() Helper Method      (no partial)

 

ClearInput() Helper Method          (no partial)

 

DisplayMessage() Helper method 

 

Display Button

-          Check for the empty array

-          Display students’ data in tabular format = 2

3

Enter Button

-          Call the helper method to validate  the input  (-1 if not done)

-          Store valid data in the arrays = 3

-          Check for full array

-          Call ClearInput()

4

Stats Button

-          Check for the empty array

-          Display number of students entered = 0.5

-          Display number of CIT students entered = 2

-          Compute the average score = 1

-           display avgwith 2 digits after the decimal  = 0.5

 

 

 

7

FormClosing event

-          Confirm with user whether to close or not = 2

-          Check for empty array

-          Open the file for saving = 0.5

-          Loop – save to the file in tab delimited format = 3

-          Close the file = 0.5

-          Exception handling = 1

 

9

Form_Loadevent

-          Check for File existence = 1

-          Open the file for reading = 1

-          While loop to read all the lines from the file = 1

-          Read a line from the file = 1

-          Split the line - retrieve pieces of data  = 1

-          Store the extracted data in parallel arrays = 3

-          Close the file

-          Include code for Exception Handling = 1

 

Penalties:

                    Programs with build errors will get an automatic 0.

Attachments:

Answers

(5)
Status NEW Posted 21 Dec 2017 07:12 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)