Problem) 1) Design a PayRoll class that has data members for an employee’s hourly pay rate and number of hours worked. 2) Write a program with an array of eleven PayRoll objects. 3) The program should...

1 answer below »
Problem) 1) Design a PayRoll class that has data members for an employee’s hourly pay rate and number of hours worked. 2) Write a program with an array of eleven PayRoll objects. 3) The program should read the number of hours each employee worked and their hourly pay rate (before tax) from a file and call class function to store this information in the appropriate objects. 4) It should then call class function, once for each object, to return the employee’s net pay after 20% tax deduction, so this information can be displayed. a. Sample data to test this program can be found in the payroll.dat file located on Blackboard. Submissioninstructions • Testyourcodebeforesubmission. • Addcommentstoexplainyoursolution.


Microsoft Word - BCS230_Lab6_handout.docx Lab06-BCS230,M.Alrajab 1 BCS230 Lab6HandoutandAssignment This lab handout provides three tasks that students are required to attempt during lab session. Lab objectives are for students to practice with: - Files - Arrays. - Classes and Objects. - Object-Oriented Analysis and Design. Task1: Attached on Blackboard: 1- inputFile.txt • Write a program that reads the numbers from the attached file and place them in an array. • Print all the elements of the array using regular for-loop. • Create a text file called output.txt and write to it the average, minimum and maximum values separated by tab space. Lab06-BCS230,M.Alrajab 2 Task2: Magic Squares One interesting application of two- dimensional arrays is magic squares. A magic square is a square matrix in which the sum of every row, every column, and both diagonals is the same. Magic squares have been studied for many years, and there are some particularly famous magic squares. In this exercise you will modify the provided shell code to determine whether a square is magic or not assuming that all elements are between 1 and 9. Your program should simulate a magic square using two-dimensional 3x3 array. It should have a Boolean function isMagicSquare that accepts the array as an argument and returns true if it is determines it is a Magic square and false it not as shown in the shell code bellow. #include usingnamespacestd; constintSIZE=3;//Arrayswillbe2-D3x3arrays //Functionprototype voidinputMagicSq(int[][SIZE],int); voidshowArray(int[][SIZE]); boolisMagicSquare(int[][SIZE]); intmain() { intarray1[SIZE][SIZE]; cout< "enter="" square="" elements="" 3x3.="" \n\n";="" todo="" 1:="" call="" the="" inputmagicsq="" to="" enter="" values="" cout="">< "you="" entered.="" \n\n";="" todo="" 2:="" call="" showarray="" to="" print="" elements="" todo="" 3:="" check="" if="" the="" square="" is="" magic="" or="" not="" return="" 0;="" }="" void="" showarray="" (int="" a[][size])="" {="" todo:="" print="" the="" square="" elements="" }="" void="" inputmagicsq(int="" sqarr[][size],="" int="" size){="" todo:="" read="" square="" elements="" }="" bool="" ismagicsquare(int="" a[][size])="" {="" int="" sum1="0," sum2="0," sum3="0;" todo:="" check="" column="" sums="" for="" (int="" row="0;" row="">< size;="" row++)="" {="" todo:="" check="" each="" column="" seperately="" }="" if="" (!(sum1="=" sum2="" &&="" sum2="=" sum3))="" return="" false;="" if="" column="" sums="" are="" ok,="" check="" row="" sums="" but="" first="" reinitialize="" the="" accumulators="" sum1="sum2" =="" sum3="0;" for="" (int="" col="0;" col="">
Answered Same DayMar 12, 2020BCS230

Answer To: Problem) 1) Design a PayRoll class that has data members for an employee’s hourly pay rate and...

Snehil answered on Mar 14 2020
141 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here