- Case StudyHelp.com
- Sample Questions
CCS10103 INTRODUCTION TO PROGRAMMING ASSIGNMENT QUESTIONS
Are you facing problems with the complex C++ programming language assignment answers? Casestudyhelp.com provide Sample, Question & Answer of C++ Programming Language Assignment in Australia, UK and USA. Get the instant online solution for Programming Help at low prices.
ASSIGNMENT
INSTRUCTION:
- Answer ALL questions.
- Mode: Group of 2 people only. (If you do not have a group please discuss with me)
- Due date:
Please take note that all the reports need to be submitted in GC and also eklas.
- Cover page Colour: BLUE
Tasks:
- Construct C++ program.
- Explain on programing logic structures used in the solution;
COURSE OUTCOME(S):
CLO1: Demonstrate the ability to formulate solutions logically by using problem solving techniques and C++ language to solve computing problems (C3, PLO6).
QUESTION 1
(a) The HOD of Information Science and Computing wants to know how well female and male students perform in certain course. Write a program to enter the course name, total number of students for that course, gender for each of the students and their GPA. The program than computes and outputs the average GPA for both female and male students. The letter code f is used for female students and m for male students. Your program should use the following functions:
- Function initialize: This function initializes variables such ascountFemale, countMale, sumFemaleGPA, and sumMaleGPA.
- Function sumGrades: This function finds the sum of the female and male students’ GPAs.
- Function averageGrade: This function finds the average GPA for female and male students.
- Function printResults: This function outputs the relevant results.
- There can be no global variables. Use the appropriate parameters to pass information in and out of functions.
(25 marks)
(b) In order to solve problem in (a), it is important to understand how the function structures work logically.
- Briefly describe the items a programmer needs to know when using a predefined function, including the header file name, the function name, the parameter type, and the return type.
- Define the terms function header (or heading), function body, and function definition. Use program develop in (a) to describe the elements of a function.
- Define the terms actual parameter and formal parameter and explain the difference between the two.
- Describe in detail the flow of execution in a program with functions. Review the use of function prototypes to facilitate compilation. Also, explain how a function call operates during program execution.
- Discuss how a function call operates in terms of how the values in the actual parameters are transferred to the formal parameters. Use program develop in (a) to illustrate this process.
(25 marks)
QUESTION 2
(a) The sales manager of your company needs a sales analysis program to track sales performances by salesperson and by quarter. Write a program using 2D array which requires user to enter the salesperson’s number, the quarter in which the sale took place and the sale amount. After scanning all sales transactions, the program should display a table in the form of below figure which includes totals by person and by quarter.
2019 Sales Analysis | |||||
Salesperson | Quarter 1 | Quarter 2 | Quarter 3 | Quarter 4 | TOTAL |
0 | 2785.00 | 2282.00 | 5720.00 | 6440.00 | 17227.00 |
1 | 4715.00 | 1676.00 | 6067.00 | 929.00 | 13387.00 |
2 | 1253.00 | 1495.00 | 2884.00 | 4173.00 | 9805.00 |
3 | 3946.00 | 1508.00 | 2844.00 | 2969.00 | 11267.00 |
QUARTER TOTALS | 12699.00 | 6961.00 | 17515.00 | 14511.00 |
(25 marks)
(b) In order to use 1D or 2D array, programmer need to become familiar with declaring and manipulating arrays, as well as using arrays as parameters.
- Describe the need for an array when processing items that are the same data type and represent the same conceptual item.
- Discuss the syntax involved in accessing array components. Review the use of the array subscripting operator with the code 2(a).
- Describe some common operations typically performed on arrays.
- Explain the consequences of using an array index that is out of bounds and discuss some common coding errors that can result in an out of bounds array index.
- Explain in more detail why C++ only allows arrays to be passed as reference parameters.
(25 marks)
FOR REF…Use #getanswers2001437