0% found this document useful (0 votes)
8 views

PPC125C Practice Lab Test

This is a University level Information Technology question paper for first year students from the Central University of Technology

Uploaded by

kkgwebdesign
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

PPC125C Practice Lab Test

This is a University level Information Technology question paper for first year students from the Central University of Technology

Uploaded by

kkgwebdesign
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Page 1 of 12

Extended Curriculum Programme (ECP)

PRACTICE LAB TEST


DATE: TIME:
SUBJECT: Programming Principles 1B CODE: PPC125C

INSTRUCTIONAL PROGRAMMES: Diploma in Computer Networking ECP, Diploma in Information Technology


INSTRUCTIONAL PROGRAMMES CODE: EX_CMN & EX_ITC

STATIONERY:
1. Lab PC or your own Laptop (BHP222, BHP224 and BHP225)
2. Visual Studio 2022
3. Practical Notes
4. Ethuto to submit zipped program
INSTRUCTIONS TO CANDIDATES:
1. Download the Practice Test template from Ethuto as instructed.
2. Add your Initials and Surname and Student number to the comments of your program
3. Code the program as described below, and Comments are optional
4. Only Edit code where stated ///STUDENT TO CODE and also bookmarks has been put in the code
for easy reference:

ASSESSOR: Mr. AD van der Walt & Mr E Mokoduwe


MODERATOR: Mr. P Kruger
Duration of Paper: N/A Total marks: N/A

Assessor’s Signature Moderator’s Signature


Page 2 of 12

Practice LAB TEST Scenario Instructions [30]

Scenario: You were asked to write an ITS program that would capture student details (Student
Number, Name, Surname, final mark) for any subject where there is up to 150 students max.
This program will be used by all the lecturers in SA. The program that you will develop will be
able to do the following:
1. Capture marks
2. ITS Report
3. Exit Program

The Capture Marks as Menu Number 1 (One) The program will capture the marks for a
subject where there could be a max of 5 students (Student Number, Name, Surname, final
mark – Parallel arrays). The user will indicate how many students there are in the class and
then capture the final marks. The system must be able to capture at least 5 students’ records
details and marks, and the user must be able to choose after each capture if they would like
to capture another record or not. If not return to Main Menu.

Menu Number 2 (Two) will create the ITS report where student data will be displayed with
their marks. At the end of the Report the following will be indicated:
• Amount Passed.
• Amount Failed.
• Average Final Mark.

Menu Number 3 (Three) will exit the program.


Menu Nr 1 and 2 will return to the Main Menu when all tasks are done. The system must have
the recommended Main Menu and must check that the correct Menu Number was entered to
continue. If the user did not enter the correct menu number an error message must be
provided, and the user must try again.

Program Specifics:
• // Add your Initials + Surname, Student Number as comments at the beginning of your
program (Just before the Namespace)
• See Appendix A for Methods and given code to be used in your program and see Appendix
B for recommended Screen Outputs. Note Code Template will also be on ethuto where given
code is already available in a project. Just add your code needed. Download the zip file and
extra to Desktop

Assessor’s Signature Moderator’s Signature


Page 3 of 12

APPENDIX A
METHODS TO COMPLETE & PARTIAL TO BE CODED ALSO:
//Global Variables
static int menuOption;
static string captureMarks;
static int passed = 0;
static int failed = 0;
static double totalMarks = 0, avgMark = 0;

//Global Arrays
static string[] studNumber = new string[5];
static string[] studName = new string[5];
static string[] studSurname = new string[5];
static double[] studfinalMark = new double[5];

static void Main()


{
Menu(); //Call Menu Method
}

static void Menu()


{
//Print Menu to user:
Console.Clear();
Console.ForegroundColor = ConsoleColor.Green; //Change color back to green
Console.WriteLine("#=================================");
Console.WriteLine("# #");
Console.WriteLine("# ITS MARK SYSTEM #");
Console.WriteLine("# MAIN MENU #");
Console.WriteLine("# #");
Console.WriteLine("# 1) ENTER MARKS #");
Console.WriteLine("# 2) ITS DATA & MARKS REPORT #");
Console.WriteLine("# 3) Exit program #");
Console.WriteLine("# #");
Console.WriteLine("#=================================");
Console.WriteLine();

//Get Menu Nr from user.


///STUDENT TO CODE:

//Check that user only enters a number between 1 and 3, else repeat.
///STUDENT TO CODE

Assessor’s Signature Moderator’s Signature


Page 4 of 12

//Change color back to default


Console.ForegroundColor = ConsoleColor.Gray;

//Switch statement to direct user to the number they have entered.


switch (menuOption)
{
case 1: //Menu Nr 1
///STUDENT TO CODE
break;

case 2: //Menu Nr 2
if (studNumber[0] == null || studNumber[0] == "")
{
Console.WriteLine("Note NO data has been captured!!");
Console.WriteLine("The program will return to Main Menu. Press any Key...");
Console.ReadKey();
Menu();
}
else
{
Console.Clear();
ITSmarkReport(); //Call ITSmarksReport Method - Menu nr 3 option
//Code to run after above method is done:
Console.WriteLine("Press any key to return to the Main Menu");
Console.ReadKey();
Menu();
}
break;

case 3: //Menu Nr 3
Exit(); //Call Exit Method
break;

default:
Console.WriteLine("A critical Error has occurred. Press any key to exit program...");
break;
}
}

Assessor’s Signature Moderator’s Signature


Page 5 of 12

static void ReadInMarks()


{
Console.Clear();
Console.WriteLine("#=================================");
Console.WriteLine("# #");
Console.WriteLine("# ITS READ IN DATA & MARKS #");
Console.WriteLine("# (MAX 5 Students) #");
Console.WriteLine("# #");
Console.WriteLine("#=================================");
Console.WriteLine();

//Confirm if user want to capture a record


Console.WriteLine("Would you like to capture a student marks? Yes or No?");
captureMarks = Console.ReadLine();

//Check that the user only enters Yes or No


///STUDENT TO CODE

//If user enters Yes, data can now be captured from the InputData Method.
if (captureMarks == "Yes")
{
InputData();
}
}

static void InputData()


{
int counter = 0;

//Reading in data as long as the array has space (Index 0 - 4 = 5 elements and as long as the user indicates Yes!
while (counter < 5 && captureMarks == "Yes")
{
//Read Student Number
Console.WriteLine("Please enter Student Number to save:");
///STUDENT TO CODE

//Read Student Name


Console.WriteLine("Please enter Student Name to save:");
///STUDENT TO CODE

//Read Student Surname


Console.WriteLine("Please enter Student Surname to save:");
///STUDENT TO CODE

Assessor’s Signature Moderator’s Signature


Page 6 of 12

//Read Stud Number


Console.WriteLine("Please enter the Final Mark to save:");
studfinalMark[counter] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine();

//Keep a counting record after data has been captured if the student passed or not.
if (studfinalMark[counter] >= 50)
{
passed++; //Add one to total of passed. To be printed in ITS Report in Menu Nr2
}
else
{
failed++; //Add one to total of failed. To be printed in ITS Report in Menu Nr2
}

//Adding each student's final mark together to calculate the average mark later.
totalMarks = totalMarks + studfinalMark[counter];
//ANOTHER WAY TO DO THE ABOVE CALC using the += operator: totalMarks += studfinalMark[counter];

//Inform the user that the data has been captured for this student.
Console.WriteLine("DATA FOR THIS STUDENT HAS BEEN CAPTURED!");

//Confirms if the user want to capture another student record.


Console.WriteLine("Would you like to capture another student marks? Yes or No?");
captureMarks = Console.ReadLine();

//Check that the user only enters Yes or No


while (captureMarks != "Yes" && captureMarks != "No")
{
Console.WriteLine("You have entered the incorrect input.");
Console.WriteLine("Would you like to capture a student marks? Yes or No?");
captureMarks = Console.ReadLine();
}
counter++; // increase counter to move the index to next array element to capture data if the user indicated yes
}
//Calculate Average mark by taking all final marks and divide by 5 (System can only take 5 records. We declare the array to have 5
items)
avgMark = totalMarks / 5;
}

Assessor’s Signature Moderator’s Signature


Page 7 of 12

static void ITSmarkReport()


{
Console.Clear();
Console.WriteLine("#=================================================================");
Console.WriteLine("# #");
Console.WriteLine("# ITS Report #");
Console.WriteLine("# #");
Console.WriteLine("#=================================================================");
Console.WriteLine();

Console.WriteLine("Student Number Name Surname Final Mark");

for ///STUDENT TO CODE - for counter will be called index


{
Console.WriteLine("{0} \t{1} \t{2} \t\t{3}", studNumber[index], studName[index], studSurname[index], studfinalMark[index]);
Console.WriteLine();

//Program outputs the statistical data:


Console.WriteLine();
Console.WriteLine("Amount Passed: {0}", passed);
Console.WriteLine("Amount Failed: {0}", failed);
Console.WriteLine("Average Final Mark: {0}", avgMark);
Console.WriteLine();
}

static void Exit()


{
//Clears the screen and wait for a key press to exit.
Console.Clear();
Console.WriteLine("#=================================");
Console.WriteLine("# #");
Console.WriteLine("# EXIT PROGRAM #");
Console.WriteLine("# #");
Console.WriteLine("# Press any key to Exit... #");
Console.WriteLine("# #");
Console.WriteLine("#=================================");
Console.WriteLine();
Console.ReadKey();
}
}
}

Assessor’s Signature Moderator’s Signature


Page 8 of 12

APPENDIX B - Recommended outputs


MAIN MENU:

Incorrect Menu Number:

Assessor’s Signature Moderator’s Signature


Page 9 of 12

Menu Nr 1:

When entering YES (sample data):

Assessor’s Signature Moderator’s Signature


Page 10 of 12

If the user indicates no then the program will return to the Main Menu:

Assessor’s Signature Moderator’s Signature


Page 11 of 12

Menu Nr 2: (If the user did not enter any records and immediately used Menu nr 2):

Menu Nr 2: (With only one data record Read in):

Assessor’s Signature Moderator’s Signature


Page 12 of 12

Menu Nr 3:

Please make sure to zip your program and upload to ethuto.

IF Marking was done:


• When marking this Lab test and if it does not compile and give errors a 0% is allocated.

MARKING RUBRIC – Student Initials & Surname: ____________________ Student Nr: ____________________
Menu Nr Functionality of Program to be tested MARK %
1 Program prompts user if they want to capture a record and if YES is provided a record is captured and after first record the user
is asked again and with a NO the program returns to the Main Menu. _______40%
2 If No records exist, the program will provide this error message and return to the Main Menu. If at least the first record exists,
then the IT Report will print, and other records will be indicated empty with a 0 final mark. _______40%
3 Program exit correctly
______/20%
TOTAL
TOTAL: ______%

Assessor’s Signature Moderator’s Signature

You might also like