联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2021-07-01 11:05

CPT/CPM 111 – Principles of Programming

Assignment 2 – Individual

Topics covered: File processing, pointers, functions, arrays

Learning About Areas of Shapes

A mathematics teacher wishes to create a program that will allow her students to learn about

area, and circumference. She plans to have a program that allow her students to key in

the length and width or base values and get the output on the values of area or

circumference. She also wants the program to reversely calculate values of height or

width or base etc given the value of area, and circumference. For example, given the

area and height then the program should be able to find the width. She has prepared

formulas for the programmer who would develop the program in the table below:

You have been assigned by your company to develop the program for this mathematics

teacher.

The teacher would like to create quiz like program that will test her students’ knowledge. She

provided you with 3 text files (one file for each shape). In each of these files there are 12 rows

and 3 columns. The first column is the values for area, the second column is for base (or

width) and the third column is for height (or length) values. The row represents a set of

values for one shape. For example, look at the Triangle.txt below, the first row has the

value of 12, 4 and 6 denoting area=12, base=4 and height=6. In each file there are 12

sets (rows) of these values. Your program should read these values.

The quiz should have three sections as follows:

? in the first section, the program would ask the user to provide the area value by giving

the base and height of each shape. These values are taken from the first four rows

in each of the text files.

? in second section, the program would ask the user to provide the height value by

giving the base and area of each shape. These values are taken from the second four

rows in each of the text files.

? the last section, the program would ask the user to provide the base or length value

by giving the area and height of each shape. These values are taken from the last

four rows in each of the text files.

Once the user answers the quiz by providing the requested values, the program will check the

value with the corresponding value given in the text file. If it is a match, 1 mark will be given.

Otherwise, no mark will be given. The same process will be repeated for each question. Marks

are accumulated for all questions. Once the user finished answering all 36 questions, the

program will show the result i.e. the total marks. This mark is then stored in a text file named

“studentMarks.txt” along with studentID. Hence, the program should prompt for

studentID before user start the quiz. StudentMarks.txt will be updated every time a user

finish the quiz. However, no one user could take the quiz twice. Thus, the program should also

check the studentID whether it existed in “studentMarks.txt”. If it existed, the student

is not allowed to take the quiz.

Programming specifications are as follows:

? You are required to create functions based on shapes where each function will accept

and return appropriate value(s).

? The main()program will prompt the user on the shape that they want to learn. Once

chosen, it will start the quiz based on the shape. When the user selects an option then

the program will prompt user for necessary input(s).

? Let say, user chooses the shape triangle, then the program will start the quiz related to

triangle. The main() program will read triangle.txt and call the function triangle to

execute the quiz as mentioned. Once done the function return the score for quiz on

triangle. It’s up to your creativity on how the parameter passing should be legally done.

? You should provide appropriate instructions and design your program interactively.

User can use the program as many times as they wish.

Text files contents:

Triangle.txt

Area Base Height

12 4 6

9 3 6

4 2 4

8 2 8

8 4 4

21 6 7

24 6 8

36 8 9

55 10 11

60 10 12

70 10 14

77 11 14

Rectangle.txt

Area Width Length

24 4 6

32 4 8

20 4 5

30 5 6

40 5 8

42 6 7

45 5 9

56 7 8

63 7 9

72 8 9

80 8 10

90 9 10

Parallelogram.txt

Area Base Height

12 3 4

16 4 4

18 6 3

15 5 3

24 6 4

25 5 5

20 5 4

22 2 11

22 2 10

32 4 8

39 3 13

40 5 8

Your program must have the following:

I. Good Interface Design (i.e. Presentable manner and easy to understand)

II. Meaningful comments in the source codes

III. Its accurate!!

IV. You will have 3 input files and one output file

V. You are required to use arrays, functions and pointers

You are required to provide the following in your documentation (report):

1. Problem Analysis (Input, Output, Process and Constraints)

2. Algorithm (Pseudocode OR Flow Chart)

3. Implementation (C++ Program)

4. Test cases (Screenshots for the test cases)

INSTRUCTIONS:

1. Solve the above exercise and upload all your source codes files to the elearning portal.

2. This is an individual assignment. Hence, please ensure that:

a. You did not copy your friends codes and you do not let they copy your codes.

b. Grade F will be given if you are proven guilty.

3. Please prepare a video presentation where you explain on the process of planning for

the solution and the execution of your codes. Please use power point presentation as

part of your video presentation. Upload the video and the power point slides to the

elearning portal.

4. No report or viva needed. Only video presentation, power point slides and source

codes. Treat power point slides and video presentation as a report. So please be clear

in explanation etc. Max length of video presentation is 10 minutes.

5. Its best that you zipped all your files and label the zip file with your name before

uploading.

6. Make sure in power point slides, you have a title slide with your name and matric

number as well as on each of your source codes file.

DUE DATE: 1 July 2021


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp