(/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me

# problems with input validation, especially when reading numeric data types using cin. Although, cin.fail() gives us some sort of solution but still it cannot handle all scenarios

INSTRUCTIONS TO CANDIDATES

Problem 1: Numeric input validation using strings                                                                                    [10 Marks] There are various problems with input validation, especially when reading numeric data types using cin. Although, cin.fail() gives us some sort of solution but still it cannot handle all scenarios, for example, 123abc is considered a valid input because 123 is read where as it an alphanumeric input.

You are required to write a program that read input as a character array/string and validate it. Table 1 shows valid and invalid input for different numeric data types.

Table 1: Numeric data types

 Date type Valid input Invalid input Integers //Only digits 123abc 1 123.123 2132 aqwe121 -3121 _12 +121 Float 12.23f 123abc -12.23f 123.123 Double 12.23 123abc -12.23 123.123asdasda 12.2f

Note: All the invalid values which cin.fail() considers should also be invalid for the program that you write.

Problem 2: Sorting and Merging                                                                                                                          [10 Marks]

Write a program that takes 5 integer arrays (of varying sizes) as input. You have to ensure that user enter these arrays in ascending order, if user enters incorrectly display a prompt to read input in correct format. Write a C++ program to produce an array that merges elements of all arrays in descending order, but it also needs to remove duplicates.

Example:

Array A_1: {1, 3, 5, 6}

Array A_2: {1, 2, 4, 8}

Array A_3: {5, 6, 7, 8}

Array A_4: {23, 24, 94, 108}

Array A_5: {1, 2, 2, 23, 24, 67, 1234}

Merged array: {1234, 108, 94, 67, 24, 23, 8, 7, 6, 5, 4, 3, 2, 1}

Note: Final array should be created/merged in sorted order. You are not allowed to do any computation on the elements entered in the Merged array. This means that different numbers will be inserted in this array in descending order and duplication will be checked at the time of insertion.

Also, no temporary arrays are allowed.

Problem 3: Employee performance reporting                                                                                             [20 Marks] Write a program that calculates performance based salary of customer support representatives (CSRs) in an organization:

1. csrID (Customer support representative ID): an array of seven strings to hold employee identification numbers. The array should be initialized with the following numbers:

CSR_01, CSR_02, CSR_03, CSR_04, CSR_05, CSR_06, CSR_07

1. csrName: an array to hold the name of each CSR, input at run time
2. hours: number of hours worked by each CSR, input at run time
3. complaintsResolved: number of complaints successfully resolved by each CSR, input at run time
4. payRate: an array of seven to hold each employee s hourly pay rate, where payRate is calculated as following:

payRate = \$25 + 25*(complaintsResolved by each CSR/total complaints resolved)

1. wages : an array hold each employee’s wages wages = hours * payRate

The program should relate the data in each array through the subscripts. For example, the number in element 0 of the hours array should be the number of hours worked by the CSR whose identification number is stored in element 0 of the csrID array. The program should do the following:

1. Display each csrID and ask the user to enter names, hours and
2. It should then calculate the payRate and gross wages for that CSR and store them in the payRate and wages array,
3. After the data has been entered for all the CSRs, the program should display each CSR’s identification number, name and gross
4. Program should also display options to display the top N CSRs on the basis of different criteria, including: number of complaintsResolved, number of hours

Note: Ensure all necessary input validation, for example, hours, complaintsResolved cannot be negative numbers.

Problem 4: Student record                                                                                                                            [40 Marks]

Write a program that helps a faculty member prepare his semester result and calculate grades of the students. Table 2 show a typical data that a faculty member would have towards the end of the semester for any course.

Table 2: Course data

 Reg No. Midterm (25) QUIZZES (10) Assignments (15) Final Exam (50) Final Score Grade Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Total A1 A2 A3 A4 Total 13 8 6 6 6 5 3 3 0 0 6 10 7 7 0 45 F 17 8 7 7 6 5 3 3 0 0 6 10 7 7 0 70 B 11 9 8 5 4 3 3 0 0 0 5 10 7 7 0 86 A 11 8 5 4 1 0 0 0 0 3 10 7 7 0 60 C

Write a program that can do the following:

1. Create string arrays to store student registration number and name
2. Create double arrays to store Midterm marks and Final exam marks
3. Create two two-dimensional arrays for at least six quizzes and six assignments

1. Calculate the final score for each student by adding Midterm, Quizzes Total, Assignments Total and Final exam score. Weightages are: Midterm 25%, Quizzes 10%, Assignments 15%, and Final Exam 50%.
2. Assign Grade and GPA to each student based on the final score, for reference use Table
3. Your program should also ask the user if he/she wants to select best of four quizzes and assignments and print alternate

## Related Questions

##### . The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

##### . Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

##### . The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

##### . Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

##### . The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

329 Experts Online