Assignment title: Information


​​ ITAP1001 - Software Development Fundamentals ASSIGNMENT Submission Instructions: • Due date & time: Friday 23rd Nov 2015 before 11.59pm • Total Marks in paper: 60 • Marks toward subject: 25 • All answers should be saved into a single MS Word document (.docx or .doc). The document should be named your student id, followed by your given name and the unit code. For example, if your name is Waqas, your student id is 234567, and the unit id is ITAP1001 then the document name should be named 234567-Waqas-ITPA1001.docx • All code you submit should be copied and pasted from Visual Studio into your Word doc. • Include your name, student id and the unit code as C# comments in every C# class. • When asked, paste a screenshot of Console input and output into your Word doc (which you can do, for example, using MS Word's "screenshot" tool, or the ALT-PRTSC keys) • You are asked to create a Visual Studio project in the last question. This project should be submitted along with your Word Doc. • The Visual Studio project and the Word document should be zipped up into a zip file that uses the same naming scheme as the Word doc e.g. 234567-Waqas-ITPA1001.zip • Upload your zip file to Moodle. • Your assignment should be completed individually. The penalty for copying is zero marks 1. Identify the errors in each of the following pieces of C# program code. Write into your MS Word document the corrected code. Note that there may be more than one error in each piece of code. (8 marks) a) if (age >= 65); Console.WriteLine("Age greater than or equal to 65"); else Console.WriteLine("Age is less than 65 )"; b) int x = 1, total; while ( x <= 10 ) { total += x; ++x; } c) int x=1; while (x <= 100) total += x; ++x; d) int y = 0; while (y > 0) { Console.WriteLine(y); ++y; } 2. A C# program is given below. Use MS Word to trace the values of each variable throughout the life of the program and to record the output. To do this: • Create a table in your MS Word document • Use variable names for the headings above each column and use the heading "Console Output" for the last column • Each new row should represent the next step in the program: that is, the line of code being processed. When complete you should have more than 11 rows in your table • In each step (row), only record changing values or new console outputs (that is, you shouldn't write a value in every cell in the table) (10 marks) 3. Write a C# application that uses a loop to display the following table of values. Paste your completed code and a screenshot of the console output into your Word doc. (12 marks) N 10*N 100*N 1000*N 1 10 100 1000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000 4. Develop the following C# application and Pseudocode: (30 marks) Your program should use Console's ReadLine method to accept the number of hours worked by 3 employees last week and their hourly rate. Your program should then display all 3 employees gross pays, formatted as currency. Any hours they worked above 40 hours should be paid at time and a half. After processing 3 employee details the program should ask the user to press "y" to try again or any other key to exit. a) In your Word doc, create an algorithm using pseudocode and 3 levels of top-down refinement to model this problem – that is top, 1st, and 2nd levels of pseudocode. Use the reserved words provided to you in the "Pseudocode Reserved Words" document. [This program is so simple that it hardly requires pseudocode at all, let alone 3 levels. Remember that the purpose of this task is to test your understanding of pseudocode, not so much to help you with writing the C# code] (7 marks) b) Convert the 2nd level pseudocode into a C# application. (20 marks) If you write all your code in a single class you can get a maximum of 10 marks. If you create 2 classes as described here you can get 20 marks. Your Main method should contain the Console.ReadLine() code that asks for hours worked and rate of pay. It should also contain code that creates 3 Employee objects from a second class called Employee. This Employee class should: a. Contain private data members b. Contain a Constructor that sets an employee's rate and hours to 0 c. Contain Rate and Hours "Properties" that set and get the private data members. The set method should validate user input d. Contain a setEmployee() method that sets both the rate and hours worked e. Contain a displayEmployee() method that displays an employee's details exactly as shown on the following page's test data Your program should not crash if invalid input (such as a String) is entered into the console and it shouldn't treat negative values as acceptable. See the test data on the following page to see how invalid input should be treated. Your code should make use of the each Property's set methods for the first 2 employees and the setEmployee() method for the 3rd. You will get a bonus of up to 5 marks if you implement an array of 3 employee objects and use for loops to process the inputs and displays for that array. If you do this, then use the default constructor and the Properties for each employee (not the setEmployee() method, which you still need to create). c) When you run the program, enter the data for 3 employees using different data to the test data used below here, and include a screenshot(s) of the console in your Word doc. (2 marks) d) Write into your Word doc the name of the exe created by compiling your application and the relative path from your project's .sln file to that exe e.g. "/source/bin/exe/employees.exe" (1 marks) e) Copy and paste your completed code into your Word doc. As instructed above, be sure to submit your Visual Studio solution along with your Word doc You can test and debug your application with this employee data: Employee 1 Enter hourly rate: 7.25 Enter hours worked: 50 Employee 2 Enter hourly rate: 8.50 Enter hours worked: 0 Employee 3 Enter hourly rate: 0 Enter hours worked: 30 Pay for employee 1 is $362.50 Pay for employee 2 is $0 Pay for employee 3 is $0 Press "y" to repeat or any other key to exit...y Employee 1 Enter hourly rate: 6.00 Enter hours worked: 50 Employee 2 Enter hourly rate: 8.50 Enter hours worked: abcde Employee 3 Enter hourly rate: -10.00 Enter hours worked: 30 Pay for employee 1 is $362.50 Pay for employee 2 is --error-- Pay for employee 3 is --error-- Press "y" to repeat or any other key to exit...n